@amplitude/analytics-browser 2.48.0 → 2.48.2-codexsemantic-review-integration.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="dclid",E="fbclid",S="gbraid",k="gclid",T="ko_click_id",x="li_fat_id",P="msclkid",I="rdt_cid",A="ttclid",_="twclid",C="wbraid",O={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],D=["authorization","cookie","set-cookie"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&L(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||N(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],F="Event skipped due to empty event type";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(j||(j={}));var q=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=j.Unknown),{event:e,code:t,message:n}},B=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},H=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),V=function(e){var t,n=B();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,V)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map(function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(H[r]):H[r]}).join("")},z={},W={get exports(){return z},set exports(e){z=e}},Y=Object.prototype.hasOwnProperty;function $(e){return"[Throws: "+(e?e.message:"?")+"]"}function K(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return $(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(Y.call(e,t))try{return e[t]}catch(e){return $(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}W.exports=function(e,t,n){return JSON.stringify(K(e),t,n)};var G,J=z.ensureProperties=K,X=z||e({__proto__:null,ensureProperties:J,get default(){return z}},[z]),Q=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=V(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,k,T;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=c(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=c(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{h&&!h.done&&(T=p.return)&&T.call(p)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(X(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||q(n,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=c(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),Z=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},ee=function(e){return{promise:e||Promise.resolve()}},te=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Q(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Z(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ee(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return ee(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new M;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ee(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ee())},e.prototype._addPlugin=function(e){return ee(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),ee())},e.prototype._removePlugin=function(e){return ee(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),U.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,q(e,0,F)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(o=a.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=q(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ee(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ne=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[G.REVENUE_PRODUCT_ID]=this.productId,e[G.REVENUE_QUANTITY]=this.quantity,e[G.REVENUE_PRICE]=this.price,e[G.REVENUE_TYPE]=this.revenueType,e[G.REVENUE_CURRENCY]=this.currency,e[G.REVENUE]=this.revenue,e[G.RECEIPT]=this.receipt,e[G.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(G||(G={}));var re;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(re||(re={}));var ie="Amplitude Logger ",oe=function(){function e(){this.logLevel=re.None}return e.prototype.disable=function(){this.logLevel=re.None},e.prototype.enable=function(e){void 0===e&&(e=re.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Verbose||console.log("".concat(ie,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Warn||console.warn("".concat(ie,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Error||console.error("".concat(ie,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Debug||console.log("".concat(ie,"[Debug]: ").concat(e.join(" ")))},e}(),ae=function(e){return void 0===e||""===e?h:e},se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:re.Warn,loggerProvider:new oe,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ue=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=se();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=ae(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=le(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),ce=function(e,t){return"EU"===e?t?b:m:t?y:g},le=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=se().serverZone),void 0===n&&(n=se().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:se().serverZone;return{serverZone:r,serverUrl:ce(r,n)}},de=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function fe(e){return e>=200&&e<300}var ve=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},pe=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},he=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ge=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=he(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},me=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,c=s.logLevel;if(c&&c<re.Debug||!c||!u)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ve(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))),d}},ye=new Set([g,m,y,b]);function be(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var we=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=V()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r=this;return u(this,function(i){switch(i.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(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]).reduce(function(t,n){return s(r,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new de,u.label=1;case 1:return u.trys.push([1,3,,4]),i=le(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!ye.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(be(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return c=u.sent(),l=(d=c)instanceof Error?d.message:String(d),this.config.loggerProvider.error(l),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:ve()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var n;fe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:be(e),stack_trace:ve()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(be(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(be(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(r),s=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(be(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:ve()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){var t=new Set(e);this.queue=this.queue.filter(function(e){return!t.has(e)}),this.saveEvents()},e}();class Ee{getApplicationContext(){return{versionName:this.versionName,language:Se(),platform:"Web",os:void 0,deviceModel:void 0}}}const Se=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class ke{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Te=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Te(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Te(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Te(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class xe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Te(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Ie{constructor(){this.identityStore=new xe,this.eventBridge=new ke,this.applicationContextProvider=new Ee}static getInstance(e){return Pe.analyticsConnectorInstances||(Pe.analyticsConnectorInstances={}),Pe.analyticsConnectorInstances[e]||(Pe.analyticsConnectorInstances[e]=new Ie),Pe.analyticsConnectorInstances[e]}}var Ae=function(e){return Ie.getInstance(ae(e))},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ae().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=Ae(e.instanceName).identityStore),[2]})})},e}(),Ce=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Oe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Re=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},De=function(){var e,t=B();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=Le(n[0]),i=Le(n[1]);return i?(e[r]=i,e):e},{}):{}},Le=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ne=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Me=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},je=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Ue=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Fe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),qe=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Be(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,o,a,s,l,d,f,v;return u(this,function(u){switch(u.label){case 0:r=B(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=c(a),l=s.next();!l.done;l=s.next())if(d=l.value,He(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{l&&!l.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=B(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=B();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var c=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=B();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Be=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},He=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},Ve=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},ze=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[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]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),We="tags",Ye="counters",$e="histograms",Ke="events",Ge="internal",Je="last_flush_timestamp",Xe=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=B())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(We)||e.createObjectStore(We,{keyPath:"key"}),e.objectStoreNames.contains(Ye)||e.createObjectStore(Ye,{keyPath:"key"}),e.objectStoreNames.contains($e)||e.createObjectStore($e,{keyPath:"key"}),e.objectStoreNames.contains(Ke))||e.createObjectStore(Ke,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(Ge)||e.createObjectStore(Ge,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([We],"readwrite"),r=n.objectStore(We),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ye],"readwrite"),r=n.objectStore(Ye),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([$e],"readwrite"),r=n.objectStore($e),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ke],"readwrite"),r=n.objectStore(Ke),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([Ge],"readwrite"),i=r.objectStore(Ge),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([Ge],"readonly"),r=n.objectStore(Ge),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Je)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Je,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([We,Ye,$e,Ke],"readwrite"),[4,Promise.all([this.getAllFromStore(t,We),this.getAllFromStore(t,Ye),this.getAllFromStore(t,$e),this.getAllFromStore(t,Ke)])];case 2:return n=l.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,Ye),this.clearTable(t,$e),this.clearTable(t,Ke)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),Qe="__AMPLITUDE_SCRIPT_URL__",Ze=function(){var e=B();if(!e)return[];var t=e[Qe];return Array.isArray(t)?t:"string"==typeof t?[t]:[]},et=function(e){var t,n,r=Ze();if(0!==r.length)try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},tt=function(e){var t,n;try{var r=new URL(e,null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.origin);return r.origin+r.pathname}catch(e){return}},nt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},rt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},it=3e5,ot=1e4,at=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=je(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:Xe.isSupported()?this.storage=new Xe(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=B();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=et({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=nt(i),a=et({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:rt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=ot?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=ot?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=ot)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},it))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],l(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(l={tags:o,histogram:s,counters:a,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!B())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 n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(it),[2]):(n=e-t)>=it?(this._flush(),[2]):(this._setFlushTimer(it-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=je(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),st=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var k=e.code||0,T=this.buildStatus(k);switch(T){case j.Success:return{status:T,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case j.Invalid:return{status:T,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case j.PayloadTooLarge:return{status:T,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case j.RateLimit:return{status:T,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case j.Timeout:default:return{status:T,statusCode:k}}},e.prototype.buildStatus=function(e){return fe(e)?j.Success:429===e?j.RateLimit:413===e?j.PayloadTooLarge:408===e?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();function ut(){return"undefined"!=typeof CompressionStream}function ct(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var lt=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(X(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){if(!this.isSupported)return Promise.resolve(!1);try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var dt=401,ft=403,vt=429,pt=function(){function e(t,n,r,i,o,a,s){void 0===r&&(r="US"),void 0===a&&(a=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=a,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=s||new lt(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=V(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.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(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,l,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),l=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:l,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(l,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===dt||f.status===ft?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==vt&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=l.sent()))return[2,s.value];if("break"===s)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),ht=B(),gt=null==ht?void 0:ht.console,mt={},yt={},bt=!1;var wt,Et={addListener:function(e,t){var n,r=(n=e,!!gt&&"function"==typeof gt[n]&&(yt[n]||(yt[n]=gt[n],gt[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(mt[n]&&!bt){bt=!0;var r=mt[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return bt=!1,yt[n].apply(gt,e)}),!0));if(!r)return new Error("Console override failed");mt[e]?mt[e].push(t):mt[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(mt)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(yt)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(gt[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}yt={},mt={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(wt||(wt={}));var St=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],kt="data-amp-track-",Tt=["div","span","h1","h2","h3","h4","h5","h6"],xt=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Pt=xt,It=xt,At=["*"];function _t(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Ct(e,t,n){e&&Ot({json:e,allowlist:t.map(Rt),excludelist:n.map(Rt),ancestors:[]})}function Ot(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=c(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],l(s),!1),[g],!1);_t(i[g])?Lt(m,o)&&!Lt(m,a)||delete i[g]:Ot({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function Rt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Dt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Dt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Dt(e,t,n+1,r+1)}function Lt(e,t){return t.some(function(t){return Dt(e,t)})}var Nt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=l(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Vt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=B();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=jt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Bt(this.body,e,t)]})})},e}(),Mt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Vt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return jt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Bt(this.body,e,t)]})})},e}();function jt(e,t){var n,r,i,o=B(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=c(u.entries()),p=v.next();!p.done;p=v.next()){var h=l(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var Ut,Ft=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),Vt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Bt(n.sent(),e,t)]}})})},e}(),qt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Vt(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Ct(n,e,t),[2,n]):[2,null]})})},e}();function Bt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Ct(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Ut||(Ut={}));var Ht="[REDACTED]",Vt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?Ut.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===Ut.REDACT&&(f[t]=Ht):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===Ut.REDACT&&(f[t]=Ht)};try{for(var p=c(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},zt=function(){function e(e,t,n,r,i,o,a,s,u,c,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],l(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],l(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=l(e,2);return t[0],void 0!==t[1]}))},e}();var Wt=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t};function Yt(e){try{e()}catch(e){}}var $t=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=B();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=B();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){Yt(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,c,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new zt(e,d,o,o,u,n,c,v,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){Yt(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Nt(r):void 0,i?new Ft(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){Yt(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&Yt(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=l(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){Yt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new qt(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new Mt(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(e){Yt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){Yt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),Kt=new $t,Gt=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},O),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=De();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=De();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[x]=t[x],e[P]=t[P],e[I]=t[I],e[A]=t[A],e[_]=t[_],e[C]=t[C],e},e}(),Jt="data-amp-mask",Xt="*****",Qt=/\b(?:\d[ -]*?){13,16}\b/,Zt=/(\d{3}-?\d{2}-?\d{4})/g,en=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,tn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(Qt,Xt)).replace(Zt,Xt)).replace(en,Xt);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,Xt)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},nn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Jt)?Xt:e?e(document.title):document.title},rn={};Object.defineProperty(rn,"__esModule",{value:!0}),rn.Observable=void 0;const on=e=>Boolean(Symbol[e]),an=e=>on(e)?Symbol[e]:"@@"+e,sn=an("iterator"),un=an("observable"),cn=an("species");function ln(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function dn(e){let t=e.constructor;return void 0!==t&&(t=t[cn],null===t&&(t=void 0)),void 0!==t?t:bn}function fn(e){fn.log?fn.log(e):setTimeout(()=>{throw e})}function vn(e){Promise.resolve().then(()=>{try{e()}catch(e){fn(e)}})}function pn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=ln(t,"unsubscribe");e&&e.call(t)}}catch(e){fn(e)}}function hn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function gn(e,t,n){e._state="running";let r=e._observer;try{let i=ln(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(hn(e),!i)throw n;i.call(r,n);break;case"complete":hn(e),i&&i.call(r)}}catch(e){fn(e)}"closed"===e._state?pn(e):"running"===e._state&&(e._state="ready")}function mn(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void vn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(gn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void gn(e,t,n);e._queue.push({type:t,value:n})}}class yn{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){mn(n,"next",e)},error(e){mn(n,"error",e)},complete(){mn(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(hn(this),pn(this))}}class bn{constructor(e){if(!(this instanceof bn))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new yn(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(dn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(dn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=dn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=dn(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=dn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[un](){return this}static from(e){let t="function"==typeof this?this:bn;if(null==e)throw new TypeError(e+" is not an object");let n=ln(e,un);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof bn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(on("iterator")&&(n=ln(e,sn),n))return new t(t=>{vn(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{vn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:bn)(t=>{vn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[cn](){return this}}rn.Observable=bn,Object.defineProperty(bn,Symbol("extensions"),{value:{symbol:un,hostReportError:fn},configurable:!0});var wn=rn.Observable;function En(e,t){return new wn(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Sn(e,t){return new wn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function kn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new wn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=c(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Tn,xn="https://app.amplitude.com",Pn={US:xn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var In="__AMPLITUDE_MESSENGER_INSTANCE__",An="__AMPLITUDE_MESSENGER__",_n=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?xn:t;this[Tn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=c(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===xn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(s.data);else{var l=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];l.push(s.data),r.pendingMessages.set(u,l)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=B();(null==e?void 0:e[An])===this&&delete e[An]},e}();function Cn(e){var t,n=B(),r=null==n?void 0:n[An];if("object"==typeof(t=r)&&null!==t&&In in t&&!0===t[In])return r;var i=new _n(e);return n&&(n[An]=i),i}Tn=In;var On=["desktop","tablet","mobile"],Rn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Dn(e,t){var n,r=e;if(!0!==r[Rn]){r[Rn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",a=null,s=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var u=new URL(i,e.endpoint).toString(),c=t&&"object"==typeof t?function(e){if("string"==typeof e)return On.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(u).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),a=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,o({messenger:e,onBackgroundCapture:s},void 0!==c?{initialDeviceMode:c}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a),a=null})}}var Ln={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Nn(e,t){var n=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var r=e/t*100;n=Math.min(100,Math.max(0,r))}return n}function Mn(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:Nn(n,r)},void 0!==t?{stop_reason:t}:{})}function jn(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function Un(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,c,d;return u(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(t){return e.getDuration(t)}),new Promise(function(t){return e.getCurrentTime(t)})])];case 1:if(i=l.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],c={},"mux"===n){d=void 0;try{d=new URL(t.getAttribute("src")),c.mux_video_title=d.searchParams.get("metadata-video-title"),c.mux_video_id=d.searchParams.get("metadata-video-id"),c.mux_playback_id=d.pathname.split("/").pop()}catch(e){}}return[2,o(o({duration:a,start_time:s,last_position:s,percent_completed:Nn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Fn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Un(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var c=function(){Un(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var l=function(){Un(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var d=function(){o=!0,Un(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,Un(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)})};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var qn=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e){a.updatePlaybackState("ended",e)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.last_position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?Fn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},Mn(e)),"mux"===n?jn(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},Mn(e,"paused")),"mux"===n?jn(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},Mn(e,"ended")),"mux"===n?jn(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},Mn(e,"seeking")),"mux"===n?jn(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},Mn(e)),"mux"===n?jn(e):{});t.onSeeked(r)};e.addEventListener("seeked",u);var c=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener("timeupdate",c),function(){e.removeEventListener("play",r),e.removeEventListener("pause",i),e.removeEventListener("ended",a),e.removeEventListener("seeking",s),e.removeEventListener("seeked",u),e.removeEventListener("timeupdate",c)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=o(o({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){var t,n;if(this.state.lastEvent&&"playing"===this.state.playbackState){var r=e.isSeeking||this.state.isSeeking,i=null!==(t=this.state.position)&&void 0!==t?t:0,a=e.position;if(r)this.state=o(o({},this.state),{position:a});else{var s=a-i,u=o(o({},this.state),{position:a,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+s});this.updateState(u)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function Bn(e,t,n){var r,i,o=[];try{for(var a=c(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function Hn(e){var t,n,r,i,o,a,s,u,f,v,p,h,g;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=c(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var E=e[w];"boolean"==typeof(null==E?void 0:E.enabled)&&(E.enabled?(delete E.enabled,0===Object.keys(E).length&&(e[w]=!0)):e[w]=!1),Hn(E)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var S=c(e.autocapture.networkTracking.captureRules),k=S.next();!k.done;k=S.next()){var T=k.value;try{for(var x=(o=void 0,c(["responseHeaders","requestHeaders"])),P=x.next();!P.done;P=x.next()){var I=P.value,A=null!==(v=T[I])&&void 0!==v?v:{},_=A.captureSafeHeaders,C=A.allowlist;(_||C)&&(void 0===C||Array.isArray(C)?T[I]=d(d([],l(_?R:[]),!1),l(null!=C?C:[]),!1):delete T[I])}}catch(e){o={error:e}}finally{try{P&&!P.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(p=e.autocapture)||void 0===p?void 0:p.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var O=null===(h=e.autocapture)||void 0===h?void 0:h.frustrationInteractions;O&&(O.rageClick&&(O.rageClicks=O.rageClick,delete O.rageClick),O.deadClick&&(O.deadClicks=O.deadClick,delete O.deadClick),O.errorClick&&(O.errorClicks=O.errorClick,delete O.errorClick));try{var D=null===(g=e.autocapture)||void 0===g?void 0:g.elementInteractions;if(D&&"object"==typeof D&&(!0===D.viewportContentUpdated&&(D.viewportContentUpdated={}),!1===D.viewportContentUpdated&&(D.viewportContentUpdated={enabled:!1}),void 0!==D.exposureDuration)){var L=D.viewportContentUpdated;void 0===L?D.viewportContentUpdated={exposureDuration:D.exposureDuration}:"object"==typeof L&&void 0===L.exposureDuration&&!1!==L.enabled&&(L.exposureDuration=D.exposureDuration),delete D.exposureDuration}}catch(e){}}}var Vn=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=B();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},zn=function(e){return Vn(e,"attribution")},Wn=function(e){return Vn(e,"formInteractions")},Yn=function(e){return Vn(e,"pageViews")},$n=function(e){return Vn(e,"sessions")},Kn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},Gn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Jn=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},Xn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},Qn=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},Zn=function(e){if(Gn(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},er=function(e){if(Xn(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tr=function(e){if(Kn(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},nr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Yn(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},rr=function(e,t){ir(e,t)},ir=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},or=function(e){return e&&void 0!==e._q};var ar="2.48.0",sr="amplitude-ts-sdk-script",ur=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(sr,"/").concat(ar),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Re()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),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})]})})},e}(),cr=1e3,lr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=B())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>cr?(i=n.length-cr,[4,e.prototype.set.call(this,t,n.slice(0,cr))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(cr,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(ze),dr=function(e){function t(){var t;return e.call(this,null===(t=B())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(ze),fr=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new Error("XHRTransport is not supported."));var d=new XMLHttpRequest;d.open("POST",e,!0),d.onreadystatechange=function(){if(d.readyState===r.state.done){var e=d.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&ut(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=c(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=l(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,ct(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(st),vr=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,c,l,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&ut(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,ct(r)]:[3,2];case 1:(c=u.sent())&&(s["Content-Encoding"]="gzip",a=c),u.label=2;case 2:return s=o(o({},this.customHeaders),s),l="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(st),pr=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=B();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(st),hr=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,c,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=l(i.split("."),6),a=o[0],s=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:mr(s),sessionId:gr(d),lastEventId:gr(p),lastEventTime:gr(f),optOut:Boolean(c)}]}})})},gr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},mr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},yr="[Amplitude]",br="".concat(yr," Form Started"),wr="".concat(yr," Form Submitted"),Er="".concat(yr," File Downloaded"),Sr="session_start",kr="session_end",Tr="".concat(yr," File Extension"),xr="".concat(yr," File Name"),Pr="".concat(yr," Link ID"),Ir="".concat(yr," Link Text"),Ar="".concat(yr," Link URL"),_r="".concat(yr," Form ID"),Cr="".concat(yr," Form Name"),Or="".concat(yr," Form Destination"),Rr="cookie",Dr=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return G},get LogLevel(){return re},get ServerZone(){return wt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:St,DEFAULT_DATA_ATTRIBUTE_PREFIX:kt,DEFAULT_ACTION_CLICK_ALLOWLIST:Tt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Ln}),Lr=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Nr=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,c=a(e,["referrer","referring_domain"]),l=t||{};l.referrer;var d,f=l.referring_domain,v=a(l,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=jr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&Br(e.referring_domain,s)){if("always"===h)return Ur(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Ur(h,e.referring_domain,r),!1}}if(Mr(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(c)!==JSON.stringify(v),m=Lr(u||"")!==Lr(f||""),y=!t||g||m;return y?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),y},Mr=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},jr=function(e,t){if(!0===e)return Ln.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Ln).includes(n))return n;if(void 0===n)return Ln.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Ur(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var Fr=["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"],qr=function(e){var t,n,r=e||(null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return Fr.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Br=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||qr(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Hr=function(e){function t(t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_,C,O,R,D,L,N,M,j,U,F,q,B,H,V,z){void 0===r&&(r=new Fe),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Rr),void 0===g&&(g=new oe),void 0===m&&(m=re.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===I&&(I=18e5),void 0===A&&(A=new lr({loggerProvider:g})),void 0===_&&(_={ipAddress:!0,language:!0,platform:!0}),void 0===C&&(C="fetch"),void 0===O&&(O=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===V&&(V=!1);var W,Y=this;(Y=e.call(this,{apiKey:t,instanceName:v,storageProvider:A,transportProvider:Wr(C)})||this).apiKey=t,Y.appVersion=n,Y.cookieOptions=i,Y.defaultTracking=o,Y.autocapture=a,Y.flushIntervalMillis=u,Y.flushMaxRetries=c,Y.flushQueueSize=l,Y.identityStorage=d,Y.ingestionMetadata=f,Y.loggerProvider=g,Y.logLevel=m,Y.minIdLength=y,Y.offline=b,Y.partnerId=E,Y.plan=S,Y.serverUrl=k,Y.serverZone=T,Y.sessionTimeout=I,Y.storageProvider=A,Y.trackingOptions=_,Y.transport=C,Y.useBatch=O,Y.fetchRemoteConfig=R,Y.networkTrackingOptions=M,Y.identify=j,Y.enableDiagnostics=U,Y.diagnosticsSampleRate=F,Y.diagnosticsClient=q,Y.remoteConfig=B,Y.topLevelDomain=H,Y.enableRequestBodyCompression=V,Y.customEnrichment=z,Y.version=ar,Y._optOut=!1,Y._cookieStorage=r,Y.deviceId=s,Y.lastEventId=p,Y.lastEventTime=h,Y.optOut=w,Y.deferredSessionId=P,Y.sessionId=x,Y.pageCounter=L,Y.userId=D,Y.debugLogsEnabled=N,Y.loggerProvider.enable(N?re.Debug:Y.logLevel),Y.networkTrackingOptions=M,Y.identify=j,Y.enableDiagnostics=U,Y.diagnosticsSampleRate=F,Y.diagnosticsClient=q;var $=null!==(W=null==B?void 0:B.fetchRemoteConfig)&&void 0!==W?W:R;return Y.remoteConfig=Y.remoteConfig||{},Y.remoteConfig.fetchRemoteConfig=$,Y.fetchRemoteConfig=$,Y.topLevelDomain=H||qr(),Y}return n(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof qe&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Oe(this.apiKey),e)},t}(ue),Vr=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_,C,O,R,D,L,N,M,j,U,F,q,B,H,z,W,Y,$,K,G,J,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||Rr,s="",a!==Rr||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)?[3,2]:[4,Yr(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=o({domain:null!==(O=null===(C=t.cookieOptions)||void 0===C?void 0:C.domain)&&void 0!==O?O:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=Be(e);if(!t)return!1;var n=JSON.parse(t);return He(n.cookieDomain,c.domain)},diagnosticsClient:r},d=zr(t.identityStorage,c,l),[4,hr(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Oe(e))];case 4:return v=u.sent(),p=De(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:V(),y=null!==(F=null==v?void 0:v.lastEventId)&&void 0!==F?F:f.lastEventId,b=null!==(q=null==v?void 0:v.lastEventTime)&&void 0!==q?q:f.lastEventTime,w=null!==(H=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==H?H:f.optOut,E=null!==(z=null==v?void 0:v.sessionId)&&void 0!==z?z:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(Y=null!==(W=t.userId)&&void 0!==W?W:null==v?void 0:v.userId)&&void 0!==Y?Y:f.userId,n.previousSessionDeviceId=null!==($=null==v?void 0:v.deviceId)&&void 0!==$?$:f.deviceId,n.previousSessionUserId=null!==(K=null==v?void 0:v.userId)&&void 0!==K?K:f.userId,T={ipAddress:null===(J=null===(G=t.trackingOptions)||void 0===G?void 0:G.ipAddress)||void 0===J||J,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},x=null==v?void 0:v.pageCounter,P=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(I=new Hr(e,t.appVersion,d,c,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,T,t.transport,t.useBatch,t.fetchRemoteConfig,k,x,P,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new Fe),[2,I]}})})},zr=function(e,t,n){switch(void 0===e&&(e=Rr),void 0===t&&(t={}),e){case"localStorage":return new lr;case"sessionStorage":return new dr;case"none":return new Fe;default:return new qe(o(o({},t),{expirationDays:t.expiration}),n)}},Wr=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new fr(n):"beacon"===t?new pr:new vr(n,r,i)},Yr=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,c;return u(this,function(u){switch(u.label){case 0:return[4,new qe(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,Fr.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,qe.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return c=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:c instanceof Error?c.message:String(c)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},$r="AMP_PAGE_VIEW",Kr=function(e){var t;void 0===e&&(e={});var n,r,i=B(),a=void 0,c=!1,d=e.trackOn,f=e.trackHistoryChanges,v=e.eventType,p=void 0===v?"[Amplitude] Page Viewed":v,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},g=function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:return t=h("undefined"!=typeof location&&location.href||""),r={event_type:p},n=[{}],[4,Gr()];case 1:return[2,(r.event_properties=o.apply(void 0,[o.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&h(location.pathname)||"","[Amplitude] Page Title":nn(tn),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},m=function(){return void 0===d||"function"==typeof d&&d()},y="undefined"!=typeof location?location.href:null,b=function(){s(void 0,void 0,void 0,function(){var e,n,i,o,s;return u(this,function(u){switch(u.label){case 0:return e=location.href,n=Xr(f,e,y||"")&&m(),y=e,n?(i=void 0,r&&(i=V(),r.set($r,{pageViewId:i})),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(o=t).track,[4,g(i)];case 2:s.apply(o,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,d,f;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),c=!0,i){try{r=new ze(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&b()}})}return m()?(a.log("Tracking page view event"),s=void 0,r&&(s=V(),r.set($r,{pageViewId:s})),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i,s;return u(this,function(u){switch(u.label){case 0:return"attribution"===d&&Jr(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r?[4,r.get($r)]:[3,2]):[3,4];case 1:i=u.sent(),t=null==i?void 0:i.pageViewId,u.label=2;case 2:return[4,g(t)];case 3:s=u.sent(),e.event_type=s.event_type,e.event_properties=o(o({},e.event_properties),s.event_properties),u.label=4;case 4:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),c=!1),[2]})})}};return w},Gr=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Ue,[4,(new Gt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Jr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],l(Object.keys(n)),!1),l(Object.keys(i)),!1);return Object.keys(O).every(function(e){return o.includes(e)})}return!1},Xr=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},Qr=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(Wn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=ei(e);a||i.track(br,((t={})[_r]=Zr(e.id),t[Cr]=Zr(e.name),t[Or]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=ei(e);if(a||i.track(br,((o={})[_r]=Zr(e.id),o[Cr]=Zr(e.name),o[Or]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(wr,((s={})[_r]=Zr(e.id),s[Cr]=Zr(e.name),s[Or]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=B())?a.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},Zr=function(e){if("string"==typeof e)return e},ei=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ti=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(Er,((t={})[Tr]=a,t[xr]=n.pathname,t[Pr]=e.id,t[Ir]=e.text,t[Ar]=e.href,t))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=B())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},ni=!1,ri=function(){var e=B(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function ii(e,t){var n,r;if(e){Hn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",X(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Bn(u,l,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),l=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=Bn(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",X(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var oi="1.30.3",ai="[Amplitude] Element Clicked",si="[Amplitude] Element Tag",ui="[Amplitude] Element Text",ci="[Amplitude] Page URL",li="[Amplitude] Viewport Height",di="[Amplitude] Viewport Width",fi="[Amplitude] Page View ID",vi="data-amp-mask-attributes",pi="data-amp-internal-shadow";function hi(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function gi(e,t){return t.map(mi).join(" > ")}function mi(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var yi=":scope > ";function bi(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function wi(e){var t,n=e.getRootNode();return bi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function Ei(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return bi(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Si(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=l(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var c=u.children,d=0;d<c.length;d++)r.push([c[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function ki(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=wi(r);n.push({root:o,target:r});var a=r.getRootNode();if(!bi(a))break;r=a.host}var s=n.length-1,u=!1,c=n;return s>t&&(c=n.slice(s-t),u=!0),{segments:c.reverse(),truncated:u}}function Ti(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&bi(i)?"".concat(n,":nth-of-type(").concat(xi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(xi(e,r.children),")")}function xi(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var Pi={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Ii(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function Ai(e){return Ii(e)}var _i={name:"stableId",try:function(e,t){var n=hi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Ai(n))}},Ci=!1,Oi=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],l([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],l([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:Ci,maxShadowDomDepth:1});function Ri(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Ci,maxShadowDomDepth:Li(e.maxShadowDomDepth)})}function Di(e,t){if(!e)return Ni();var n,r=Ni();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Li(e.maxShadowDomDepth),Ri(r)}function Li(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Ni(){return{enabled:Oi.enabled,explicitTrackingAttribute:Oi.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(Oi.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(Oi.unstableClassPatterns),!1),maxAncestorWalkDepth:Oi.maxAncestorWalkDepth,shadowDomEnabled:Oi.shadowDomEnabled,maxShadowDomDepth:Oi.maxShadowDomDepth}}var Mi=[Pi,_i];function ji(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Ri(t),l=null!==(o=n.strategies)&&void 0!==o?o:Mi,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=c(l),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=gi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(Ui(d,E,e,g.name,n.logger))return E}else if(Ui(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Ui(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function Fi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var qi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Bi=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new qi(Vi(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new qi(a,!0)}var s=e.tagName.toLowerCase();if(o)return new qi(s+Vi(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new qi(s,!0);for(var l=Hi(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(l);if(y.size)for(var b=Hi(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+Ii(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var k=c(l),T=k.next();!T.done;T=k.next()){S+="."+Ii(T.value.slice(1))}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}return new qi(S,!1)},Hi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Vi=function(e){return"#"+Ii(e)};function zi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Bi(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Wi(e,t){void 0===t&&(t={});var n=Ri(e),r=new Set,i=t.logger,o=function(e){return zi(e,i)},a=function(e,r){var o;return null!==(o=ji(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Ri(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=bi(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=hi(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(Ai(p))],l(u),!1).join(" > ");if(Fi(a,h,e))return h}u.unshift(Ti(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(yi).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&bi(t)?"".concat(yi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=ki(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var c=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(c)),zi(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Ri(e);try{for(var a=c(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var l=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(l))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var Yi,$i,Ki=Object.freeze({enabled:!1,maxDepth:0}),Gi=function(){var e=Ki,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=c(d([],l(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},Ji=["input","select","textarea"],Xi=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ne(window.location.href,n))&&!!Ne(window.location.href,t)},Qi=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!s)return!1;if(a)return a(n,r);if(!Xi(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var c=t.some(function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!c)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},Zi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},eo=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},to=function(){var e;try{var t=B(),n=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},no=function(e,t,n){return void 0===n&&(n=Ki),n.enabled?io(e,t,n.maxDepth):ro(e,t)},ro=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:ro(null==e?void 0:e.parentElement,t):null},io=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=c(Ei(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},oo=function(e,t,n){return void 0===n&&(n=Ki),n.enabled?so(e,t,n.maxDepth):ao(e,t)},ao=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},so=function(e,t,n){var r=ao(e,t),i=e instanceof Document?e.documentElement:e;return i?(Si(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},uo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function co(e){if(!e)return"";try{var t=new URL(e);return t.search="",Me(t.href)}catch(t){return Me(e)}}function lo(e){var t,n;return void 0===e&&(e=B()),co(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}($i||($i={}));var fo="__AMPLITUDE_VISUAL_TAGGING__";var vo=function(){var e,t,n,r,i=B();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var po=B(),ho=function(e){return e.get()},go={childList:!0,attributes:!0,characterData:!0,subtree:!0},mo=function(e){return new wn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),bi(e)&&i.set(e,t),s.observe(e,go))},a=function(e,t,n){var r=n-t;r<=0||Si(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=ho(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!bi(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var l=c(n),d=l.next();!d.done;d=l.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},yo=function(e){return void 0===e&&(e="click"),new wn(function(t){var n,r=function(e){t.next(e)};return null===(n=B())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=B())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},bo=function(){var e=Sn(new wn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return po.addEventListener("error",t),function(){po.removeEventListener("error",t)}}),new wn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return po.addEventListener("unhandledrejection",t),function(){po.removeEventListener("unhandledrejection",t)}}));return Sn(e,new wn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Et.addListener("error",t),function(){Et.removeListener(t)}}))},wo=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},Eo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},So=function(e){var t,n,r,i,o=Object.values(Eo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(r=void 0,c(u.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=Eo[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},ko=function(e){var t,n,r,i,o=new Map;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(r=void 0,c(u.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},To=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Eo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},xo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,a=new Set;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var l=u.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(To(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=a.value;wo(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Po=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",vi,Jt,pi]),Io=["type"],Ao=["svg","path","g"],_o=["password","hidden"];function Co(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=Ki),null===e)return null;var l=String(e.tagName).toLowerCase(),d={tag:l},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&bi(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!Po.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Ji.includes(i)&&!o}(e);if(!_o.includes(String(e.getAttribute("type")))&&!Ao.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!Io.includes(E.name)||(t.has(E.name)?g[E.name]=Xt:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[pi]="true",a)),d.shadow=!0),d}function Oo(e,t){return void 0===t&&(t=Ki),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(Ei(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var Ro;var Do=function(e,t){var n,r,i,a=this;this.replaceSensitiveString=function(e){return tn(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=Oo(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=Zi(h.getAttribute(vi)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return Co(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=c(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=o(o({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=o(o({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),a.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=Di(e,t),u=a.selectorEngine.getConfig().enabled,c=a.shadowGate.get().enabled,l=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?Ki:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!c&&l.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,c,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},c=n,Object.entries(u).reduce(function(e,t){var n=l(t,2),r=n[0],i=n[1];if(r.startsWith(c)){var o=r.replace(c,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[si]=d,r[ui]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[ci]=Me(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=nn(a.replaceSensitiveString),r[li]=window.innerHeight,r[di]=window.innerWidth,r),y=to();if(y&&(m[fi]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return eo(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=Ki),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=ki(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var c=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=no(u,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=a.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(Jt,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=c(o),u=s.next();!u.done;u=s.next()){var l=u.value;l.nodeType!==Node.TEXT_NODE?l instanceof Element&&(l.hasAttribute(Jt)||l.hasAttribute("contenteditable")?i+=Xt:i+=a.getTextWithMaskedDescendants(l)):i+=l.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!Oo(e,t).some(function(e){return e.hasAttribute(Jt)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(Jt))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(Jt,"]"))}(e)},this.getText=function(e){if(a.hasMaskedAncestor(e))return Xt;var t="";return t=e.querySelector("[".concat(Jt,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[si]=i,t[ui]=a.getText(e),t[ci]=window.location.href.split("?")[0],t);return eo(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Ro||(Ro=Wi(Di())),Ro),this.shadowGate=(Yi||(Yi=Gi()),Yi);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=c(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function Lo(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var No,Mo=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function jo(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,s=new Map,u=new Set,c=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},l=function(e){if(function(e){var t=B(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,a=Math.max(i.left,0),s=Math.min(i.right,r);if(o<-1||o>n+1||a>=s||i.width<=0)return!1;for(var u=Mo(e,t.getComputedStyle(e).position);u;){var c=t.getComputedStyle(u),l=c.overflowY&&"visible"!==c.overflowY,d=c.overflowX&&"visible"!==c.overflowX;if(l||d){var f=u.getBoundingClientRect();if(l&&(o<f.top-1||o>f.bottom+1))return!1;if(d&&(a=Math.max(a,f.left))>=(s=Math.min(s,f.right)))return!1}u=Mo(u,c.position)}return!0}(e)){if(!a.get(e)&&!s.get(e)){var t=setTimeout(function(){a.set(e,!0);var t=r.getElementPath(e);n(t),s.set(e,null)},o);s.set(e,t)}}else c(e)},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(u.add(n),l(n)):(u.delete(n),c(n))}),p=f.subscribe(function(){u.forEach(l)}),h=function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function Uo(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,c=e.exposureDuration,l=e.quietMs,d=void 0===l?150:l,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},c+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(No||(No={}));var Fo=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",oi);var w=e.dataAttributePrefix,E=void 0===w?kt:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:St,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Tt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var T=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),x=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:x}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,I,A="@amplitude/plugin-autocapture-browser",_=[],C=new Do(e,t),O=new Set,R=new Set,D=new Set,L=function(){var t,n,r=kn(yo().map(function(t){return C.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=kn(new wn(function(t){var n,r=function(n){var r=C.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=B())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=B())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=kn(new wn(function(t){var n=function(n){var r=C.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=C.shadowGate,a=kn(mo(o).map(function(t){return C.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new wn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=B())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=B())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=B())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=B())||void 0===t||t.removeEventListener("resize",r)}}),u=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new wn(function(n){var r=B();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:0}),s=t.join(","),u=function(e){e instanceof Element&&e.matches(s)&&a.observe(e),e.querySelectorAll(s).forEach(function(e){a.observe(e)})},c=function(e){if(o)try{oo(e,s,ho(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&ho(o).enabled?oo(e,s,ho(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(r.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)u(e);else if(e instanceof Element)if(o&&ho(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(e)}else u(e)})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),a.disconnect()}})}(a,e.cssSelectorAllowlist,function(e){I=e},o);return(t={})[No.ChangeObservable]=i,t[No.ClickObservable]=r,t[No.MutationObservable]=a,t[No.NavigateObservable]=n,t[No.ScrollObservable]=s,t[No.ExposureObservable]=u,t},N=So(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=ko(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new xo(e,t,n,r)}(N,M,C,e);return{name:A,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,c,f,v,p,h,g,m,y,b,w,S,U,F,q,H,V,z,W,Y,$,K,G,J,X,Q,Z,ee,te,ne,re,ie,oe,ae,se,ue,ce,le,de,fe;return u(this,function(u){return"undefined"==typeof document||(r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=So(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=ko(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),C.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(a=Lo(t,C))&&_.push({unsubscribe:a}),s=Qi(e,e.cssSelectorAllowlist),c=Qi(e,e.actionClickAllowlist),f=L(),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(uo).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ai,e.targetElementProperties)})}({allObservables:f,amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(uo).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:f,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,l=s.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=no(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(uo).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Sn(u,c):u,f=Sn(l,d),v=null,p=null;return En(f,function(e){if(v&&(clearTimeout(v),v=null),"click"===e.type)return p=e,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(ai,i("click",e.closestTrackedAncestor)))})}({allObservables:f,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:c}),h&&_.push(h),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=vo(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=vo(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:f,amplitude:n}),_.push(g),m=o({},g.getState()),y=function(){g.seed();var e=g.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,S=!1,F={},q=B(),V=function(){var e;g.reset();var t=g.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,D.clear(),O.clear(),R.clear(),null===(e=F.exposure)||void 0===e||e.reset(),null==H||H.reset()},z=function(){b=!0},W=function(e){if(b)return e?void V():void(w=!0);e&&(null==H||H.reset()),e&&r?V():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,c=e.exposureTracker,l=e.isPageEnd,d=e.lastScroll,f=o.getState(),v=B(),p=null!==(n=null==v?void 0:v.innerWidth)&&void 0!==n?n:0,h=null!==(r=null==v?void 0:v.innerHeight)&&void 0!==r?r:0,g=Array.from(a).filter(function(e){return!u.has(e)}),m=((t={})[ci]=lo(v),t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+h,t["[Amplitude] Min Page Y"]=f.minY,t[li]=h,t[di]=p,t["[Amplitude] Element Exposed"]=g,t),y=to();y&&(m[fi]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,s.clear(),u.clear(),null==c||c.reset()};0!==g.length||f.maxX!==d.maxX||f.maxY!==d.maxY||f.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,d.minY=f.minY,g.forEach(function(e){u.add(e)}),a.clear(),l&&b()):l&&b()}({amplitude:n,scrollTracker:g,currentElementExposed:D,elementExposedForPage:O,elementExposedInSentEvents:R,exposureTracker:F.exposure,isPageEnd:e,lastScroll:m}))},$=function(){Y&&(clearTimeout(Y),Y=void 0)},K=function(){$(),Y=setTimeout(function(){Y=void 0,G()},0)},G=function(){if($(),null==U||U.removeEventListener("abort",K),U=void 0,b){b=!1,g.reset(),y();var e=w,t=S;w=!1,S=!1,e&&W(t)}},J=function(){$(),null==U||U.removeEventListener("abort",K),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||G()},Q=function(e){$(),null==U||U.removeEventListener("abort",K),U=void 0,e&&(e.aborted?G():(U=e,e.addEventListener("abort",K,{once:!0})))},Z=lo(q),ee=function(e){var t=lo(q);return t!==Z&&(b&&e&&e.deferScrollBaseline?(J(),V(),Z=t,!0):(Z=t,W(!0),(null==e?void 0:e.deferScrollBaseline)?(z(),!0):(y(),!1)))},te=function(e,t){var n=lo(q),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return lo(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return co(new URL(e,r).href)}catch(e){return lo(t)}}(t,q);n!==r?(Z=r,W(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,O,R,D,W)},T&&(F.exposure=jo({allObservables:f,onExposure:ne,dataExtractor:C,exposureDuration:x}),F.exposure&&_.push(F.exposure),H=Uo({mutationObservable:f[No.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==I||I()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),W(!1)},exposureDuration:x}),H.start(),_.push({unsubscribe:function(){null==H||H.stop()}}),re=function(){if(b)return S=!0,w=!0,void G();W(!0)},null==q||q.addEventListener("beforeunload",re),P=function(){null==q||q.removeEventListener("beforeunload",re)},_.push({unsubscribe:function(){return P()}}),(ie=f[No.NavigateObservable])?(_.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=co(i);if(o===Z)return;return b?(w=!1,S=!1,Z=o,W(!0),void Q(e.event.signal)):(Z=o,W(!0),z(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",G),oe.addEventListener("navigateerror",X),_.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",G),oe.removeEventListener("navigateerror",X)}}))):q&&(ae=function(){ee()},q.addEventListener("popstate",ae),se=q.history.pushState,ue=q.history.replaceState,q.history&&se&&(q.history.pushState=new Proxy(se,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),q.history&&ue&&(q.history.replaceState=new Proxy(ue,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),_.push({unsubscribe:function(){q.removeEventListener("popstate",ae),q.history&&se&&(q.history.pushState=se),q.history&&ue&&(q.history.replaceState=ue)}}))),null===(fe=null==t?void 0:t.loggerProvider)||void 0===fe||fe.log("".concat(A," has been successfully added.")),window.opener&&k.enabled&&(ce=e.cssSelectorAllowlist,le=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[fo]){n[fo]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:oi}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(de=Cn(),{dataExtractor:C,isElementSelectable:Qi(e,d(d([],l(ce),!1),l(le),!1)),cssSelectorAllowlist:ce,actionClickAllowlist:le}),Dn(de),de.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Pn[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=c(_),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},qo=["mutation","navigate"];function Bo(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Ho(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Vo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,c=[],l={},d=null;function f(e){c=[],l={},e&&(Bo(l,e),c.push(e))}var v=En(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return Bo(l,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||l.isOutOfBounds?(d&&(t=Ho(c)),f(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Ho(c))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var zo,Wo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(zo||(zo={})),function(e){e.X="x",e.Y="y"}(Wo||(Wo={}));function Yo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function $o(e){e.changes=[],e.startTime=void 0}function Ko(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Go=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new wn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),$o(n),$o(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Wo.X?n:i);var t=function(e,t){var n=void 0;if(Yo(e)&&(n=e.startTime),Yo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),Ko(n),Ko(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},Jo=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new wn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===zo.DECREASING&&e.next(Wo.X),r=zo.INCREASING):o.x<n.x&&(r===zo.INCREASING&&e.next(Wo.X),r=zo.DECREASING),o.y>n.y?(i===zo.DECREASING&&e.next(Wo.Y),i=zo.INCREASING):o.y<n.y&&(i===zo.INCREASING&&e.next(Wo.Y),i=zo.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Go({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){Xi(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Xo(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Qo=4e3,Zo=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=Xo(e,"rageClicks",At,f),h=Xo(e,"deadClicks",Pt,a),g=Xo(e,"errorClicks",It,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:kt,y=new Do(e),b=d([],l(new Set(d(d(d([],l(p),!1),l(h),!1),l(g),!1))),!1),w=function(){var e,t,n=function(e){return kn(yo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=kn(bo().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=kn(mo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=kn(new wn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=kn(new wn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),c=kn(new wn(function(e){var t=function(t){e.next(t)},n={capture:!0};return po.document.addEventListener("mousemove",t,n),function(){po.document.removeEventListener("mousemove",t,n)}}));return(e={})[No.ClickObservable]=r,e[No.PointerDownObservable]=i,e[No.MutationObservable]=s,e[No.NavigateObservable]=t,e[No.BrowserErrorObservable]=a,e[No.SelectionObservable]=u,e[No.MouseMoveObservable]=c,e};return{name:n,type:"enrichment",setup:function(t,c){return s(void 0,void 0,void 0,function(){var s,l,d,b,E,S,k,T,x,P,I,A;return u(this,function(u){return"undefined"==typeof document||(s=w(),(l=Lo(t,y))&&r.push({unsubscribe:l}),f&&(d=Qi(e,p),b=Vo({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=Qi(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return uo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===$i.LEFT_OR_TOUCH_CONTACT}),l=u?Sn(s,u):s,d=Sn(c,l),f=null;return En(d,function(e){return f&&qo.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(k=Qi(e,g),T=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return uo(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===$i.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return Sn(s,a).subscribe(function(e){var n;if("click"===e.type)return l(),c=e,void(u=setTimeout(l,2e3));"error"===e.type&&c&&(t.track("[Amplitude] Error Click",o(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),c.targetElementProperties)),l())})}({amplitude:c,allObservables:s,shouldTrackErrorClick:k}),r.push(T)),v&&(x=void 0,P=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,P=e.thrashedCursor.threshold,x&&x<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),P&&P>Qo&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(Qo,", setting to ").concat(Qo)),P=Qo)),I=Jo({amplitude:c,options:e,allObservables:s,directionChanges:x,thresholdMs:P}),r.push(I)),null===(A=null==t?void 0:t.loggerProvider)||void 0===A||A.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function ea(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function ta(e,t){var n,r=ea(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),c=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function na(e,t){var n,r=ea(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function ra(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=c(e.getEntries()),l=u.next();!l.done;l=u.next()){var d=l.value;if(!Xi(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?ta(d,a):na(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var ia,oa,aa=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,c;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=ra({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},sa="[Amplitude] Network Request",ua="500-599";function ca(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function la(e,t){var n,r,i=t.split(",");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function da(e){var t;if(e)try{var n=null===(t=B())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function fa(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(R),!1);if(void 0===e){return}}}function va(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function pa(e,t){var n;void 0===t&&(t={});var r=da(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(ca(o,"*.amplitude.com")||ca(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return ca(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!la(e.status,ua))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return ca(t,e)}))&&(!r||!e.urls||Ne(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!la(n,e.statusCodeRange||ua))}(t,o,e.status,e.url,e.method),i){var n=fa(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=fa(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!va(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!va(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===sa}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function ha(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return pa(e.event,n)}).subscribe(function(e){var t,n,o,a=e.event,c=da(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=l.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(sa,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(ia||(ia={}));var ga=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new wn(function(e){var n=new Wt(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return Kt.subscribe(n,t),function(){Kt.unsubscribe(n)}});return(e={})[ia.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=B();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,oa=ha({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return oa.unsubscribe(),[2]})})}}},ma="web-vitals-browser",ya="[Amplitude] Web Vitals",ba={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let wa=-1;const Ea=()=>wa,Sa=e=>{addEventListener("pageshow",t=>{t.persisted&&(wa=t.timeStamp,e(t))},!0)},ka=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},Ta=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},xa=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Pa=()=>xa()?.activationStart??0;let Ia=-1;const Aa=new Set,_a=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ca=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Aa)e();isFinite(Ia)||(Ia="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Ca,!0))}},Oa=(e=!1)=>{if(e&&(Ia=1/0),Ia<0){const e=Pa(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;Ia=t??_a(),addEventListener("visibilitychange",Ca,!0),addEventListener("prerenderingchange",Ca,!0),Sa(()=>{setTimeout(()=>{Ia=_a()})})}return{get firstHiddenTime(){return Ia},onHidden(e){Aa.add(e)}}},Ra=(e,t=-1,n,r=0,i,o,a)=>{const s=xa(),u=s?.navigationId||0;let c="navigate";return n?c=n:Ea()>=0?c="back-forward-cache":s&&(document.prerendering||Pa()>0?c="prerender":document.wasDiscarded?c="restore":s.type&&(c=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:r||u,navigationInteractionId:i,navigationURL:o||s?.name,navigationStartTime:a||0}},Da=new WeakMap;function La(e,t){let n=Da.get(t);return n||(n=new WeakMap,Da.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Na{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Ma=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},ja=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,Ua=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Fa=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class qa{l}const Ba=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ha=[1800,3e3],Va=(e,t={})=>{const n=ja(t);Ba(()=>{const r=La(t,qa),i=Oa();let o,a=Ra("FCP");const s=Ma(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-Pa(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=ka(e,a,Ha,t.reportAllChanges),Sa(n=>{a=Ra("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Ea()),o=ka(e,a,Ha,t.reportAllChanges),Ta(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&Ma(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&Ua(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=Ra("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=ka(e,a,Ha,t.reportAllChanges),o(!0)})},t)})},za=[.1,.25],Wa=(e,t={})=>{const n=Oa();Va(Fa(()=>{let r,i=Ra("CLS",0);const o=La(t,Na),a=(n,a,s,u,c)=>{i=Ra("CLS",0,n,a,s,u,c),o.i=0,r=ka(e,i,za,t.reportAllChanges)},s=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},u=e=>{s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s()},l=["layout-shift"];ja(t)&&l.push("soft-navigation");const d=Ma(l,c);d&&(r=ka(e,i,za,t.reportAllChanges),n.onHidden(()=>{c(d.takeRecords()),r(!0)}),Sa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ea()),Ta(r)}),setTimeout(r))}))};let Ya=0,$a=1/0,Ka=0;const Ga=e=>{for(const t of e)t.interactionId&&($a=Math.min($a,t.interactionId),Ka=Math.max(Ka,t.interactionId),Ya=Ka?(Ka-$a)/7+1:0)};let Ja;const Xa=()=>Ja?Ya:performance.interactionCount??0;class Qa{u=0;v=[];m=new Map;p;T;_(){return Xa()-this.u}M(){this.u=Xa(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const Za=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=Fa(e);let o=-1;const a=()=>{r(o),i()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",a,{capture:!0}),i()},{timeout:t})}},es=[200,500],ts=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Oa();Ba(()=>{"interactionCount"in performance||Ja||(Ja=Ma(["event"],Ga,{durationThreshold:0}));let r,i=Ra("INP");const o=La(t,Qa),a=(n,a,s,u,c)=>{o.M(),i=Ra("INP",-1,n,a,s,u,c),r=ka(e,i,es,t.reportAllChanges)},s=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},u=e=>{s(),r(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=(e,t=!1)=>{Za(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},l=["event","first-input"];ja(t)&&l.push("soft-navigation");const d=Ma(l,c,{...t,durationThreshold:t.durationThreshold??40});r=ka(e,i,es,t.reportAllChanges),d&&(n.onHidden(()=>{c(d.takeRecords(),!0)}),Sa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ea())}))})};class ns{p;l;h(e){this.p?.(e)}}const rs=[2500,4e3],is=(e,t={})=>{let n=!1;const r=ja(t);Ba(()=>{let i,o=Oa(),a=Ra("LCP");const s=La(t,ns),u=(r,s,u,c,l)=>{a=Ra("LCP",-1,r,s,u,c,l),i=ka(e,a,rs,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=Oa(!0))},c=e=>{s.l&&e.navigationId&&Ua(s.l,e),n||i(!0),u("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&l([t])},l=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Pa(),0),s.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!a.navigationId)continue;if("interactionId"in i&&i.interactionId!=a.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(s.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(a.value=e,a.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const f=Ma(d,l);if(f){i=ka(e,a,rs,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;Za(()=>{if(!n){if(!r){f.disconnect();for(const e of o)removeEventListener(e,s,{capture:!0})}e===a.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,s,{capture:!0});Sa(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Ea()),i=ka(e,a,rs,t.reportAllChanges),Ta(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},os=[800,1800],as=e=>{document.prerendering?Ba(()=>as(e)):"complete"!==document.readyState?addEventListener("load",()=>as(e),!0):setTimeout(e)},ss=(e,t={})=>{const n=ja(t);let r=Ra("TTFB"),i=ka(e,r,os,t.reportAllChanges);as(()=>{const o=xa();if(o){const a=o.responseStart;r.value=Math.max(a-Pa(),0),r.entries=[o],i(!0),Sa(()=>{r=Ra("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ea()),i=ka(e,r,os,t.reportAllChanges),i(!0)}),n&&Ma(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=Ra("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=ka(e,r,os,t.reportAllChanges),i(!0))})},t)}})};function us(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function cs(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(us(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var ls=Object.values(ba);var ds,fs=function(){var e,t=null,n=B(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,a=new Set;return{name:ma,type:"enrichment",setup:function(n,l){return s(void 0,void 0,void 0,function(){var s,d,f,v,p,h,g,m;return u(this,function(u){return void 0===r||(o=!0,s=new Map,d=-1,f=function(e){var t=e.navigationId,o=s.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var a=Me(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":Me(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Me(a.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),s.set(t,o)),o},v=function(e){a.add(e);var t=s.get(e);t&&(s.delete(e),function(e){return ls.some(function(t){return t in e})}(t)&&l.track(ya,t))},p=function(){var e,t;try{for(var n=c(Array.from(s.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;v(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},h=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=c(Array.from(s.keys())),o=i.next();!o.done;o=i.next()){var a=o.value;a<t&&v(a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},is((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=cs(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(ba.LCP),m),Va(g(ba.FCP),m),ts(g(ba.INP),m),Wa(g(ba.CLS),m),ss(g(ba.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&p()},r.addEventListener("visibilitychange",t)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},vs=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=B();return e&&"PerformanceSoftNavigation"in e}()?fs():function(){var e=null,t=B(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:ma,type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=Me((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Me((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Me(o.split("?")[0],t.loggerProvider)},is(function(e){a["[Amplitude] LCP"]=cs(e)}),Va(function(e){a["[Amplitude] FCP"]=cs(e)}),ts(function(e){a["[Amplitude] INP"]=cs(e)}),Wa(function(e){a["[Amplitude] CLS"]=cs(e)}),ss(function(e){a["[Amplitude] TTFB"]=cs(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(ya,a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},ps=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Ve(t.apiKey,"MKTG"),this.webExpStorageKey=Ve(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=O,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Ce(this.sessionTimeout,this.lastEventTime),Nr(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]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new Gt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},O),t),i=Object.entries(r).reduce(function(e,t){var r,i=l(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new M),Z(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),hs=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),gs=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,l,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=B(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new Gt).parse()];case 1:return e=t.sent(),v=Ue(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];c=y(i),f.history.pushState=c,l=y(a),f.history.replaceState=l,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return hs.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===c&&i&&(f.history.pushState=i),h&&t===l&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,c=void 0,l=void 0,v={},[2]})})}}},ms="AMP_CURRENT_PAGE",ys="AMP_PREVIOUS_PAGE",bs="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(ds||(ds={}));var ws=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),Es=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=B(),i=void 0,a=!1,c=void 0,d=!1,f=!1,v=function(e){var t;try{t=new URL(e).hostname}catch(e){null==c||c.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return ds.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?ds.Internal:ds.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(bs)]:[3,3];case 1:return e=s.sent(),t=Me("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[ms])||"",r=void 0,r=t===n?(null==e?void 0:e[ys])||"":n||(document.referrer||""),[4,i.set(bs,(o={},o[ms]=t,o[ys]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){var t,n,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((c=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new ze(r.sessionStorage)}catch(e){null==c||c.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=Me("undefined"!=typeof location&&location.href||""),[4,i.get(bs)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[ms])||"",!!n&&n!==o&&m!==s?[4,i.set(bs,(y={},y[ms]=s,y[ys]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(s){switch(s.label){case 0:return t=Me("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(bs)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[ys])||"",ws.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":Ss(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":Ss(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":Ss(e,"[Amplitude] Page Path","undefined"!=typeof location&&Me(location.pathname)||""),"[Amplitude] Page Title":Ss(e,"[Amplitude] Page Title",nn(tn)),"[Amplitude] Page URL":Ss(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(bs,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function Ss(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var ks=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},Ts="userProperty",xs="eventProperty",Ps=function(e){return e===Ts||e===xs},Is=[Ts,xs],As=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(Ps))),!1);return t.length>0?t:d([],l(Is),!1)}(e.trackingMethod).includes(t)},_s=function(e){return As(e,Ts)},Cs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ee(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,c,l,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_=this;return u(this,function(C){switch(C.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new oe,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:re.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,p?(m=new pt(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:C.sent(),C.label=2;case 2:return(w=new at(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(sr,"/").concat(ar)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=B();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,Vr(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=C.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ii(t,E),e()})})]:[3,5];case 4:C.sent(),C.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return C.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,D=this.config,S=zn(D.defaultTracking)&&D.defaultTracking&&"object"==typeof D.defaultTracking&&D.defaultTracking.attribution&&"object"==typeof D.defaultTracking.attribution?o({},D.defaultTracking.attribution):{},zn(this.config.defaultTracking)&&_s(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new ps(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new ps(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:C.sent(),C.label=8;case 8:return k=De(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!T||Date.now()<T,P=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(I=this.config.deferredSessionId)||this.config.optOut||(I=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:P)&&void 0!==f?f:I)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(A=Ae(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(ri()).promise];case 9:C.sent(),C.label=10;case 10:return[4,this.add(new we({diagnosticsClient:w})).promise];case 11:return C.sent(),[4,this.add(new ur).promise];case 12:return C.sent(),[4,this.add(new _e).promise];case 13:return C.sent(),function(e){ni||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),ni=!0)}(this.config),R=this.config.defaultTracking,Vn(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ti()).promise]):[3,15];case 14:C.sent(),C.label=15;case 15:return Wn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Qr()).promise]):[3,17];case 16:C.sent(),C.label=17;case 17:return Yn(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Kr(nr(this.config))).promise]):[3,20];case 18:return C.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Kr(nr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),C.label=20;case 20:return zn(this.config.defaultTracking)&&function(e){return As(e,xs)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(gs(S)).promise]):[3,22];case 21:C.sent(),C.label=22;case 22:return Gn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Fo(Zn(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:C.sent(),C.label=24;case 24:return Xn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Zo(er(this.config))).promise]):[3,26];case 25:C.sent(),C.label=26;case 26:return Kn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ga(tr(this.config))).promise]):[3,28];case 27:C.sent(),C.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.webVitals||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(vs(Jn(this.config))).promise]):[3,30];case 29:C.sent(),C.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(aa(Qn(this.config))).promise]):[3,32];case 31:C.sent(),C.label=32;case 32:return function(e){return Vn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Es()).promise]):[3,34];case 33:C.sent(),C.label=34;case 34:return("boolean"==typeof(O=this.config.customEnrichment)?O:"object"==typeof O&&null!==O&&!1!==O.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(ks()).promise]):[3,36];case 35:C.sent(),C.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return C.sent(),A.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=o(o({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});_.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var O,R,D})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){Ae(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){Ae(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(V()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new M,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=c(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=l(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ee(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ee(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ee(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,$n(this.config.defaultTracking)&&(r&&i&&n.push(this.track(kr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Z(this.config.identify)).promise),$n(this.config.defaultTracking)&&n.push(this.track(Sr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Wr(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(or(t)){var r=t._q;t._q=[],t=ir(new M,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(or(r)){var o=r._q;r._q=[],r=ir(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(or(t)){var r=t._q;t._q=[],t=ir(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!_s(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Ce(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Sr||t.event_type===kr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",X(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(te),Os=function(){var e=new Cs;return{init:me(e.init.bind(e),"init",pe(e),ge(e,["config"])),add:me(e.add.bind(e),"add",pe(e),ge(e,["config.apiKey","timeline.plugins"])),remove:me(e.remove.bind(e),"remove",pe(e),ge(e,["config.apiKey","timeline.plugins"])),track:me(e.track.bind(e),"track",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),logEvent:me(e.logEvent.bind(e),"logEvent",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),identify:me(e.identify.bind(e),"identify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),groupIdentify:me(e.groupIdentify.bind(e),"groupIdentify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),setGroup:me(e.setGroup.bind(e),"setGroup",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),revenue:me(e.revenue.bind(e),"revenue",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),flush:me(e.flush.bind(e),"flush",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),getUserId:me(e.getUserId.bind(e),"getUserId",pe(e),ge(e,["config","config.userId"])),setUserId:me(e.setUserId.bind(e),"setUserId",pe(e),ge(e,["config","config.userId"])),getDeviceId:me(e.getDeviceId.bind(e),"getDeviceId",pe(e),ge(e,["config","config.deviceId"])),setDeviceId:me(e.setDeviceId.bind(e),"setDeviceId",pe(e),ge(e,["config","config.deviceId"])),reset:me(e.reset.bind(e),"reset",pe(e),ge(e,["config","config.userId","config.deviceId"])),getSessionId:me(e.getSessionId.bind(e),"getSessionId",pe(e),ge(e,["config"])),setSessionId:me(e.setSessionId.bind(e),"setSessionId",pe(e),ge(e,["config"])),extendSession:me(e.extendSession.bind(e),"extendSession",pe(e),ge(e,["config"])),setOptOut:me(e.setOptOut.bind(e),"setOptOut",pe(e),ge(e,["config"])),setTransport:me(e.setTransport.bind(e),"setTransport",pe(e),ge(e,["config"])),getIdentity:me(e.getIdentity.bind(e),"getIdentity",pe(e),ge(e,["config"])),setIdentity:me(e.setIdentity.bind(e),"setIdentity",pe(e),ge(e,["config","config.userId","config.deviceId"])),getOptOut:me(e.getOptOut.bind(e),"getOptOut",pe(e),ge(e,["config"])),_setDiagnosticsSampleRate:me(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",pe(e),ge(e,["config"]))}},Rs=Os(),Ds=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(e){return this.videoEl=e,this},e.prototype.withEmbeddedPlayer=function(e){return this.embeddedVideoPlayer=e,this},e.prototype.withVendor=function(e){return this.vendor=e,this},e.prototype.withExtraEventProperties=function(e){return this.extraEventProperties=e,this},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){"playing"!==t.playbackState&&"playing"===n.playbackState&&e.amplitude.track("Video Content Started",o(o({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){"playing"===t.playbackState&&"playing"!==n.playbackState&&e.amplitude.track("Video Content Stopped",o(o(o({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new qn({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();var Ls=Rs.add,Ns=Rs.extendSession,Ms=Rs.flush,js=Rs.getDeviceId,Us=Rs.getIdentity,Fs=Rs.getOptOut,qs=Rs.getSessionId,Bs=Rs.getUserId,Hs=Rs.groupIdentify,Vs=Rs.identify,zs=Rs.init,Ws=Rs.logEvent,Ys=Rs.remove,$s=Rs.reset,Ks=Rs.revenue,Gs=Rs.setDeviceId,Js=Rs.setGroup,Xs=Rs.setIdentity,Qs=Rs.setOptOut,Zs=Rs.setSessionId,eu=Rs.setTransport,tu=Rs.setUserId,nu=Rs.track,ru=Rs._setDiagnosticsSampleRate,iu=Object.freeze({__proto__:null,add:Ls,extendSession:Ns,flush:Ms,getDeviceId:js,getIdentity:Us,getOptOut:Fs,getSessionId:qs,getUserId:Bs,groupIdentify:Hs,identify:Vs,init:zs,logEvent:Ws,remove:Ys,reset:$s,revenue:Ks,setDeviceId:Gs,setGroup:Js,setIdentity:Xs,setOptOut:Qs,setSessionId:Zs,setTransport:eu,setUserId:tu,track:nu,_setDiagnosticsSampleRate:ru,createInstance:Os,AmplitudeBrowser:Cs,runQueuedFunctions:rr,Revenue:ne,Identify:M,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new Ds(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o({view_session_id:V()},a)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:Dr});!function(e){if(e.scriptUrl){var t=tt(e.scriptUrl);t&&function(e){var t=B();if(t){var n=Ze();n.includes(e)||(n.push(e),t[Qe]=n)}}(t)}}({scriptUrl:function(){if("undefined"==typeof document)return;var e=document.currentScript;if(null==e?void 0:e.src)return e.src;return}()}),function(){var e=B();if(e){var t=function(e){var t=Os(),n=B();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},iu,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],rr(iu,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitude._iq[o],t(o)),s=a._q;a._q=[],rr(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
1
+ !function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="dclid",E="fbclid",S="gbraid",k="gclid",T="ko_click_id",x="li_fat_id",P="msclkid",I="rdt_cid",A="ttclid",_="twclid",O="wbraid",C={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],D=["authorization","cookie","set-cookie"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&L(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||N(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],F="Event skipped due to empty event type";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(j||(j={}));var q=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=j.Unknown),{event:e,code:t,message:n}},B=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},V=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),H=function(e){var t,n=B();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,H)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map(function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(V[r]):V[r]}).join("")},z={},K={get exports(){return z},set exports(e){z=e}},W=Object.prototype.hasOwnProperty;function Y(e){return"[Throws: "+(e?e.message:"?")+"]"}function $(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return Y(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(W.call(e,t))try{return e[t]}catch(e){return Y(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}K.exports=function(e,t,n){return JSON.stringify($(e),t,n)};var G,J=z.ensureProperties=$,X=z||e({__proto__:null,ensureProperties:J,get default(){return z}},[z]),Q=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=H(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,k,T;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=c(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=c(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{h&&!h.done&&(T=p.return)&&T.call(p)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(X(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||q(n,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=c(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),Z=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},ee=function(e){return{promise:e||Promise.resolve()}},te=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Q(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Z(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ee(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return ee(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new M;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ee(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ee())},e.prototype._addPlugin=function(e){return ee(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),ee())},e.prototype._removePlugin=function(e){return ee(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),U.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,q(e,0,F)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(o=a.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=q(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ee(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ne=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[G.REVENUE_PRODUCT_ID]=this.productId,e[G.REVENUE_QUANTITY]=this.quantity,e[G.REVENUE_PRICE]=this.price,e[G.REVENUE_TYPE]=this.revenueType,e[G.REVENUE_CURRENCY]=this.currency,e[G.REVENUE]=this.revenue,e[G.RECEIPT]=this.receipt,e[G.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(G||(G={}));var re;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(re||(re={}));var ie="Amplitude Logger ",oe=function(){function e(){this.logLevel=re.None}return e.prototype.disable=function(){this.logLevel=re.None},e.prototype.enable=function(e){void 0===e&&(e=re.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Verbose||console.log("".concat(ie,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Warn||console.warn("".concat(ie,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Error||console.error("".concat(ie,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Debug||console.log("".concat(ie,"[Debug]: ").concat(e.join(" ")))},e}(),ae=function(e){return void 0===e||""===e?h:e},se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:re.Warn,loggerProvider:new oe,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ue=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=se();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=ae(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=le(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),ce=function(e,t){return"EU"===e?t?b:m:t?y:g},le=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=se().serverZone),void 0===n&&(n=se().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:se().serverZone;return{serverZone:r,serverUrl:ce(r,n)}},de=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function fe(e){return e>=200&&e<300}var ve=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},pe=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},he=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ge=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=he(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},me=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,c=s.logLevel;if(c&&c<re.Debug||!c||!u)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ve(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))),d}},ye=new Set([g,m,y,b]);function be(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var we=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=H()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r=this;return u(this,function(i){switch(i.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(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]).reduce(function(t,n){return s(r,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new de,u.label=1;case 1:return u.trys.push([1,3,,4]),i=le(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!ye.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(be(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return c=u.sent(),l=(d=c)instanceof Error?d.message:String(d),this.config.loggerProvider.error(l),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:ve()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var n;fe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:be(e),stack_trace:ve()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(be(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(be(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(r),s=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(be(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:ve()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){var t=new Set(e);this.queue=this.queue.filter(function(e){return!t.has(e)}),this.saveEvents()},e}();class Ee{getApplicationContext(){return{versionName:this.versionName,language:Se(),platform:"Web",os:void 0,deviceModel:void 0}}}const Se=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class ke{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Te=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Te(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Te(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Te(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class xe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Te(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Ie{constructor(){this.identityStore=new xe,this.eventBridge=new ke,this.applicationContextProvider=new Ee}static getInstance(e){return Pe.analyticsConnectorInstances||(Pe.analyticsConnectorInstances={}),Pe.analyticsConnectorInstances[e]||(Pe.analyticsConnectorInstances[e]=new Ie),Pe.analyticsConnectorInstances[e]}}var Ae=function(e){return Ie.getInstance(ae(e))},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ae().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=Ae(e.instanceName).identityStore),[2]})})},e}(),Oe=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Ce=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Re=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},De=function(){var e,t=B();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=Le(n[0]),i=Le(n[1]);return i?(e[r]=i,e):e},{}):{}},Le=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ne="AMP_PAGE_VIEW",Me=Symbol.for("@amplitude/page-view-state"),je=function(e){return e||""},Ue=function(){return B()},Fe=function(e){var t;void 0===e&&(e=Ue());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(Ne);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},qe=function(e,t,n){var r;try{var i=e.sessionStorage;if(!i)return;var a=function(e){var t,n,r={};if(!e||"object"!=typeof e)return r;try{for(var i=c(Object.entries(e)),o=i.next();!o.done;o=i.next()){var a=l(o.value,2),s=a[0],u=a[1];"string"==typeof u&&(r[s]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(null===(r=Fe(e))||void 0===r?void 0:r.byApiKey),s=je(t);s&&(a[s]=n),i.setItem(Ne,JSON.stringify(o({pageViewId:n},Object.keys(a).length>0?{byApiKey:a}:{})))}catch(e){}},Be=function(e,t){var n,r=Ue();if(r){var i=je(e),o=null!==(n=r[Me])&&void 0!==n?n:{byApiKey:{}},a=o.byApiKey[i];if(a&&a.href===t)return qe(r,e,a.pageViewId),a.pageViewId;var s=H();return o.byApiKey[i]={pageViewId:s,href:t},r[Me]=o,qe(r,e,s),s}},Ve=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Ue())||void 0===e?void 0:e[Me]}())||void 0===t?void 0:t.byApiKey[je(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=Fe();if(t){var n=je(e);if(n&&t.byApiKey&&"object"==typeof t.byApiKey){var r=t.byApiKey[n];return"string"==typeof r?r:void 0}return"string"==typeof t.pageViewId?t.pageViewId:void 0}}(e)},He="[Amplitude] SDK Initialization Offset",ze=Symbol.for("@amplitude/sdk-initialization-offset"),Ke=function(e){var t=B();if(!t)return 0;var n=t[ze];n||(n={byApiKey:{}},t[ze]=n);var r=function(e){return e||""}(e),i=n.byApiKey[r];if("number"==typeof i)return i;var o=We(t);return n.byApiKey[r]=o,o},We=function(e){var t,n;try{var r=null===(n=null===(t=e.performance)||void 0===t?void 0:t.now)||void 0===n?void 0:n.call(t);return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):0}catch(e){return 0}},Ye=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},$e=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Ge=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Je=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Xe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),Qe=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Ze(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,o,a,s,l,d,f,v;return u(this,function(u){switch(u.label){case 0:r=B(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=c(a),l=s.next();!l.done;l=s.next())if(d=l.value,et(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{l&&!l.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=B(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=B();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var c=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=B();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Ze=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},et=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},tt=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},nt=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[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]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),rt="tags",it="counters",ot="histograms",at="events",st="internal",ut="last_flush_timestamp",ct=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=B())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(rt)||e.createObjectStore(rt,{keyPath:"key"}),e.objectStoreNames.contains(it)||e.createObjectStore(it,{keyPath:"key"}),e.objectStoreNames.contains(ot)||e.createObjectStore(ot,{keyPath:"key"}),e.objectStoreNames.contains(at))||e.createObjectStore(at,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(st)||e.createObjectStore(st,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([rt],"readwrite"),r=n.objectStore(rt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([it],"readwrite"),r=n.objectStore(it),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([ot],"readwrite"),r=n.objectStore(ot),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([at],"readwrite"),r=n.objectStore(at),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([st],"readwrite"),i=r.objectStore(st),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([st],"readonly"),r=n.objectStore(st),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(ut)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(ut,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([rt,it,ot,at],"readwrite"),[4,Promise.all([this.getAllFromStore(t,rt),this.getAllFromStore(t,it),this.getAllFromStore(t,ot),this.getAllFromStore(t,at)])];case 2:return n=l.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,it),this.clearTable(t,ot),this.clearTable(t,at)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),lt="__AMPLITUDE_SCRIPT_URL__",dt=function(){var e=B();if(!e)return[];var t=e[lt];return Array.isArray(t)?t:"string"==typeof t?[t]:[]},ft=function(e){var t,n,r=dt();if(0!==r.length)try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},vt=function(e){var t,n;try{var r=new URL(e,null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.origin);return r.origin+r.pathname}catch(e){return}},pt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ht=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},gt=3e5,mt=1e4,yt=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:ct.isSupported()?this.storage=new ct(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=B();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=ft({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=pt(i),a=ft({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:ht(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=mt?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=mt?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=mt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},gt))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],l(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(l={tags:o,histogram:s,counters:a,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!B())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 n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(gt),[2]):(n=e-t)>=gt?(this._flush(),[2]):(this._setFlushTimer(gt-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),bt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var k=e.code||0,T=this.buildStatus(k);switch(T){case j.Success:return{status:T,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case j.Invalid:return{status:T,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case j.PayloadTooLarge:return{status:T,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case j.RateLimit:return{status:T,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case j.Timeout:default:return{status:T,statusCode:k}}},e.prototype.buildStatus=function(e){return fe(e)?j.Success:429===e?j.RateLimit:413===e?j.PayloadTooLarge:408===e?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();function wt(){return"undefined"!=typeof CompressionStream}function Et(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var St=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(X(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){if(!this.isSupported)return Promise.resolve(!1);try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var kt=401,Tt=403,xt=429,Pt=function(){function e(t,n,r,i,o,a,s){void 0===r&&(r="US"),void 0===a&&(a=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=a,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=s||new St(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=H(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.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(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,l,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),l=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:l,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(l,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===kt||f.status===Tt?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==xt&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=l.sent()))return[2,s.value];if("break"===s)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),It=B(),At=null==It?void 0:It.console,_t={},Ot={},Ct=!1;var Rt,Dt={addListener:function(e,t){var n,r=(n=e,!!At&&"function"==typeof At[n]&&(Ot[n]||(Ot[n]=At[n],At[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(_t[n]&&!Ct){Ct=!0;var r=_t[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Ct=!1,Ot[n].apply(At,e)}),!0));if(!r)return new Error("Console override failed");_t[e]?_t[e].push(t):_t[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(_t)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(Ot)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(At[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Ot={},_t={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Rt||(Rt={}));var Lt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Nt="data-amp-track-",Mt=["div","span","h1","h2","h3","h4","h5","h6"],jt=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Ut=jt,Ft=jt,qt=["*"];function Bt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Vt(e,t,n){e&&Ht({json:e,allowlist:t.map(zt),excludelist:n.map(zt),ancestors:[]})}function Ht(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=c(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],l(s),!1),[g],!1);Bt(i[g])?Wt(m,o)&&!Wt(m,a)||delete i[g]:Ht({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function zt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Kt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Kt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Kt(e,t,n+1,r+1)}function Wt(e,t){return t.some(function(t){return Kt(e,t)})}var Yt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=l(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return tn(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=B();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Gt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Zt(this.body,e,t)]})})},e}(),$t=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),tn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Gt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Zt(this.body,e,t)]})})},e}();function Gt(e,t){var n,r,i,o=B(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=c(u.entries()),p=v.next();!p.done;p=v.next()){var h=l(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var Jt,Xt=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),tn(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Zt(n.sent(),e,t)]}})})},e}(),Qt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return tn(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Vt(n,e,t),[2,n]):[2,null]})})},e}();function Zt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Vt(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Jt||(Jt={}));var en="[REDACTED]",tn=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?Jt.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===Jt.REDACT&&(f[t]=en):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===Jt.REDACT&&(f[t]=en)};try{for(var p=c(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},nn=function(){function e(e,t,n,r,i,o,a,s,u,c,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],l(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],l(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=l(e,2);return t[0],void 0!==t[1]}))},e}();var rn=function(e,t){void 0===t&&(t=H()),this.callback=e,this.id=t};function on(e){try{e()}catch(e){}}var an=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=B();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=B();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){on(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,c,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new nn(e,d,o,o,u,n,c,v,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){on(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Yt(r):void 0,i?new Xt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){on(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&on(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=l(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new Qt(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new $t(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),sn=new an,un=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},C),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=De();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=De();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[x]=t[x],e[P]=t[P],e[I]=t[I],e[A]=t[A],e[_]=t[_],e[O]=t[O],e},e}(),cn="data-amp-mask",ln="*****",dn=/\b(?:\d[ -]*?){13,16}\b/,fn=/(\d{3}-?\d{2}-?\d{4})/g,vn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,pn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(dn,ln)).replace(fn,ln)).replace(vn,ln);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,ln)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},hn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(cn)?ln:e?e(document.title):document.title},gn={};Object.defineProperty(gn,"__esModule",{value:!0}),gn.Observable=void 0;const mn=e=>Boolean(Symbol[e]),yn=e=>mn(e)?Symbol[e]:"@@"+e,bn=yn("iterator"),wn=yn("observable"),En=yn("species");function Sn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function kn(e){let t=e.constructor;return void 0!==t&&(t=t[En],null===t&&(t=void 0)),void 0!==t?t:Cn}function Tn(e){Tn.log?Tn.log(e):setTimeout(()=>{throw e})}function xn(e){Promise.resolve().then(()=>{try{e()}catch(e){Tn(e)}})}function Pn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=Sn(t,"unsubscribe");e&&e.call(t)}}catch(e){Tn(e)}}function In(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function An(e,t,n){e._state="running";let r=e._observer;try{let i=Sn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(In(e),!i)throw n;i.call(r,n);break;case"complete":In(e),i&&i.call(r)}}catch(e){Tn(e)}"closed"===e._state?Pn(e):"running"===e._state&&(e._state="ready")}function _n(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void xn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(An(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void An(e,t,n);e._queue.push({type:t,value:n})}}class On{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){_n(n,"next",e)},error(e){_n(n,"error",e)},complete(){_n(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(In(this),Pn(this))}}class Cn{constructor(e){if(!(this instanceof Cn))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new On(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(kn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(kn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=kn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=kn(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=kn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[wn](){return this}static from(e){let t="function"==typeof this?this:Cn;if(null==e)throw new TypeError(e+" is not an object");let n=Sn(e,wn);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof Cn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(mn("iterator")&&(n=Sn(e,bn),n))return new t(t=>{xn(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{xn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:Cn)(t=>{xn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[En](){return this}}gn.Observable=Cn,Object.defineProperty(Cn,Symbol("extensions"),{value:{symbol:wn,hostReportError:Tn},configurable:!0});var Rn=gn.Observable;function Dn(e,t){return new Rn(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Ln(e,t){return new Rn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function Nn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new Rn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=c(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Mn,jn="https://app.amplitude.com",Un={US:jn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Fn="__AMPLITUDE_MESSENGER_INSTANCE__",qn="__AMPLITUDE_MESSENGER__",Bn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?jn:t;this[Mn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=c(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===jn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(s.data);else{var l=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];l.push(s.data),r.pendingMessages.set(u,l)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=B();(null==e?void 0:e[qn])===this&&delete e[qn]},e}();function Vn(e){var t,n=B(),r=null==n?void 0:n[qn];if("object"==typeof(t=r)&&null!==t&&Fn in t&&!0===t[Fn])return r;var i=new Bn(e);return n&&(n[qn]=i),i}Mn=Fn;var Hn=["desktop","tablet","mobile"],zn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Kn(e,t){var n,r=e;if(!0!==r[zn]){r[zn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",a=null,s=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var u=new URL(i,e.endpoint).toString(),c=t&&"object"==typeof t?function(e){if("string"==typeof e)return Hn.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(u).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),a=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,o({messenger:e,onBackgroundCapture:s},void 0!==c?{initialDeviceMode:c}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a),a=null})}}var Wn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Yn(e,t){var n=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var r=e/t*100;n=Math.min(100,Math.max(0,r))}return n}function $n(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:Yn(n,r)},void 0!==t?{stop_reason:t}:{})}function Gn(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function Jn(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,c,d;return u(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(t){return e.getDuration(t)}),new Promise(function(t){return e.getCurrentTime(t)})])];case 1:if(i=l.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],c={},"mux"===n){d=void 0;try{d=new URL(t.getAttribute("src")),c.mux_video_title=d.searchParams.get("metadata-video-title"),c.mux_video_id=d.searchParams.get("metadata-video-id"),c.mux_playback_id=d.pathname.split("/").pop()}catch(e){}}return[2,o(o({duration:a,start_time:s,last_position:s,percent_completed:Yn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Xn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Jn(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var c=function(){Jn(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var l=function(){Jn(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var d=function(){o=!0,Jn(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,Jn(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)})};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var Qn=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e){a.updatePlaybackState("ended",e)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.last_position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?Xn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},$n(e)),"mux"===n?Gn(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},$n(e,"paused")),"mux"===n?Gn(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},$n(e,"ended")),"mux"===n?Gn(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},$n(e,"seeking")),"mux"===n?Gn(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},$n(e)),"mux"===n?Gn(e):{});t.onSeeked(r)};e.addEventListener("seeked",u);var c=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener("timeupdate",c),function(){e.removeEventListener("play",r),e.removeEventListener("pause",i),e.removeEventListener("ended",a),e.removeEventListener("seeking",s),e.removeEventListener("seeked",u),e.removeEventListener("timeupdate",c)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=o(o({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){var t,n;if(this.state.lastEvent&&"playing"===this.state.playbackState){var r=e.isSeeking||this.state.isSeeking,i=null!==(t=this.state.position)&&void 0!==t?t:0,a=e.position;if(r)this.state=o(o({},this.state),{position:a});else{var s=a-i,u=o(o({},this.state),{position:a,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+s});this.updateState(u)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function Zn(e,t,n){var r,i,o=[];try{for(var a=c(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function er(e){var t,n,r,i,o,a,s,u,f,v,p,h,g;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=c(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var E=e[w];"boolean"==typeof(null==E?void 0:E.enabled)&&(E.enabled?(delete E.enabled,0===Object.keys(E).length&&(e[w]=!0)):e[w]=!1),er(E)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var S=c(e.autocapture.networkTracking.captureRules),k=S.next();!k.done;k=S.next()){var T=k.value;try{for(var x=(o=void 0,c(["responseHeaders","requestHeaders"])),P=x.next();!P.done;P=x.next()){var I=P.value,A=null!==(v=T[I])&&void 0!==v?v:{},_=A.captureSafeHeaders,O=A.allowlist;(_||O)&&(void 0===O||Array.isArray(O)?T[I]=d(d([],l(_?R:[]),!1),l(null!=O?O:[]),!1):delete T[I])}}catch(e){o={error:e}}finally{try{P&&!P.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(p=e.autocapture)||void 0===p?void 0:p.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var C=null===(h=e.autocapture)||void 0===h?void 0:h.frustrationInteractions;C&&(C.rageClick&&(C.rageClicks=C.rageClick,delete C.rageClick),C.deadClick&&(C.deadClicks=C.deadClick,delete C.deadClick),C.errorClick&&(C.errorClicks=C.errorClick,delete C.errorClick));try{var D=null===(g=e.autocapture)||void 0===g?void 0:g.elementInteractions;if(D&&"object"==typeof D&&(!0===D.viewportContentUpdated&&(D.viewportContentUpdated={}),!1===D.viewportContentUpdated&&(D.viewportContentUpdated={enabled:!1}),void 0!==D.exposureDuration)){var L=D.viewportContentUpdated;void 0===L?D.viewportContentUpdated={exposureDuration:D.exposureDuration}:"object"==typeof L&&void 0===L.exposureDuration&&!1!==L.enabled&&(L.exposureDuration=D.exposureDuration),delete D.exposureDuration}}catch(e){}}}var tr=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=B();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},nr=function(e){return tr(e,"attribution")},rr=function(e){return tr(e,"formInteractions")},ir=function(e){return tr(e,"pageViews")},or=function(e){return tr(e,"sessions")},ar=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},sr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},ur=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},cr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},lr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},dr=function(e){if(sr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},fr=function(e){if(cr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},vr=function(e){if(ar(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},pr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return ir(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},hr=function(e,t){gr(e,t)},gr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},mr=function(e){return e&&void 0!==e._q};var yr="2.48.2-codexsemantic-review-integration.0",br="amplitude-ts-sdk-script",wr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(br,"/").concat(yr),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Re()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:H(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent})]})})},e}(),Er=1e3,Sr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=B())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>Er?(i=n.length-Er,[4,e.prototype.set.call(this,t,n.slice(0,Er))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(Er,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(nt),kr=function(e){function t(){var t;return e.call(this,null===(t=B())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(nt),Tr=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new Error("XHRTransport is not supported."));var d=new XMLHttpRequest;d.open("POST",e,!0),d.onreadystatechange=function(){if(d.readyState===r.state.done){var e=d.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&wt(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=c(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=l(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,Et(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(bt),xr=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,c,l,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&wt(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,Et(r)]:[3,2];case 1:(c=u.sent())&&(s["Content-Encoding"]="gzip",a=c),u.label=2;case 2:return s=o(o({},this.customHeaders),s),l="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(bt),Pr=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=B();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(bt),Ir=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,c,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=l(i.split("."),6),a=o[0],s=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:_r(s),sessionId:Ar(d),lastEventId:Ar(p),lastEventTime:Ar(f),optOut:Boolean(c)}]}})})},Ar=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},_r=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Or="[Amplitude]",Cr="".concat(Or," Form Started"),Rr="".concat(Or," Form Submitted"),Dr="".concat(Or," File Downloaded"),Lr="session_start",Nr="session_end",Mr="".concat(Or," File Extension"),jr="".concat(Or," File Name"),Ur="".concat(Or," Link ID"),Fr="".concat(Or," Link Text"),qr="".concat(Or," Link URL"),Br="".concat(Or," Form ID"),Vr="".concat(Or," Form Name"),Hr="".concat(Or," Form Destination"),zr="cookie",Kr=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return G},get LogLevel(){return re},get ServerZone(){return Rt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Lt,DEFAULT_DATA_ATTRIBUTE_PREFIX:Nt,DEFAULT_ACTION_CLICK_ALLOWLIST:Mt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Wn}),Wr=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Yr=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,c=a(e,["referrer","referring_domain"]),l=t||{};l.referrer;var d,f=l.referring_domain,v=a(l,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=Gr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&Zr(e.referring_domain,s)){if("always"===h)return Jr(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Jr(h,e.referring_domain,r),!1}}if($r(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(c)!==JSON.stringify(v),m=Wr(u||"")!==Wr(f||""),y=!t||g||m;return y?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),y},$r=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},Gr=function(e,t){if(!0===e)return Wn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Wn).includes(n))return n;if(void 0===n)return Wn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Jr(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var Xr=["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"],Qr=function(e){var t,n,r=e||(null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return Xr.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Zr=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||Qr(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},ei=function(e){function t(t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_,O,C,R,D,L,N,M,j,U,F,q,B,V,H,z){void 0===r&&(r=new Xe),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=zr),void 0===g&&(g=new oe),void 0===m&&(m=re.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===I&&(I=18e5),void 0===A&&(A=new Sr({loggerProvider:g})),void 0===_&&(_={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===C&&(C=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===H&&(H=!1);var K,W=this;(W=e.call(this,{apiKey:t,instanceName:v,storageProvider:A,transportProvider:ri(O)})||this).apiKey=t,W.appVersion=n,W.cookieOptions=i,W.defaultTracking=o,W.autocapture=a,W.flushIntervalMillis=u,W.flushMaxRetries=c,W.flushQueueSize=l,W.identityStorage=d,W.ingestionMetadata=f,W.loggerProvider=g,W.logLevel=m,W.minIdLength=y,W.offline=b,W.partnerId=E,W.plan=S,W.serverUrl=k,W.serverZone=T,W.sessionTimeout=I,W.storageProvider=A,W.trackingOptions=_,W.transport=O,W.useBatch=C,W.fetchRemoteConfig=R,W.networkTrackingOptions=M,W.identify=j,W.enableDiagnostics=U,W.diagnosticsSampleRate=F,W.diagnosticsClient=q,W.remoteConfig=B,W.topLevelDomain=V,W.enableRequestBodyCompression=H,W.customEnrichment=z,W.version=yr,W._optOut=!1,W._cookieStorage=r,W.deviceId=s,W.lastEventId=p,W.lastEventTime=h,W.optOut=w,W.deferredSessionId=P,W.sessionId=x,W.pageCounter=L,W.userId=D,W.debugLogsEnabled=N,W.loggerProvider.enable(N?re.Debug:W.logLevel),W.networkTrackingOptions=M,W.identify=j,W.enableDiagnostics=U,W.diagnosticsSampleRate=F,W.diagnosticsClient=q;var Y=null!==(K=null==B?void 0:B.fetchRemoteConfig)&&void 0!==K?K:R;return W.remoteConfig=W.remoteConfig||{},W.remoteConfig.fetchRemoteConfig=Y,W.fetchRemoteConfig=Y,W.topLevelDomain=V||Qr(),W}return n(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof Qe&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Ce(this.apiKey),e)},t}(ue),ti=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_,O,C,R,D,L,N,M,j,U,F,q,B,V,z,K,W,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||zr,s="",a!==zr||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)?[3,2]:[4,ii(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=o({domain:null!==(C=null===(O=t.cookieOptions)||void 0===O?void 0:O.domain)&&void 0!==C?C:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=Ze(e);if(!t)return!1;var n=JSON.parse(t);return et(n.cookieDomain,c.domain)},diagnosticsClient:r},d=ni(t.identityStorage,c,l),[4,Ir(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Ce(e))];case 4:return v=u.sent(),p=De(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:H(),y=null!==(F=null==v?void 0:v.lastEventId)&&void 0!==F?F:f.lastEventId,b=null!==(q=null==v?void 0:v.lastEventTime)&&void 0!==q?q:f.lastEventTime,w=null!==(V=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==V?V:f.optOut,E=null!==(z=null==v?void 0:v.sessionId)&&void 0!==z?z:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(W=null!==(K=t.userId)&&void 0!==K?K:null==v?void 0:v.userId)&&void 0!==W?W:f.userId,n.previousSessionDeviceId=null!==(Y=null==v?void 0:v.deviceId)&&void 0!==Y?Y:f.deviceId,n.previousSessionUserId=null!==($=null==v?void 0:v.userId)&&void 0!==$?$:f.userId,T={ipAddress:null===(J=null===(G=t.trackingOptions)||void 0===G?void 0:G.ipAddress)||void 0===J||J,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},x=null==v?void 0:v.pageCounter,P=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(I=new ei(e,t.appVersion,d,c,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,T,t.transport,t.useBatch,t.fetchRemoteConfig,k,x,P,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new Xe),[2,I]}})})},ni=function(e,t,n){switch(void 0===e&&(e=zr),void 0===t&&(t={}),e){case"localStorage":return new Sr;case"sessionStorage":return new kr;case"none":return new Xe;default:return new Qe(o(o({},t),{expirationDays:t.expiration}),n)}},ri=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new Tr(n):"beacon"===t?new Pr:new xr(n,r,i)},ii=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,c;return u(this,function(u){switch(u.label){case 0:return[4,new Qe(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,Xr.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,Qe.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return c=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:c instanceof Error?c.message:String(c)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},oi=function(e){var t;void 0===e&&(e={});var n,r,i=B(),a=void 0,c=!1,d=e.trackOn,f=e.trackHistoryChanges,v=e.eventType,p=void 0===v?"[Amplitude] Page Viewed":v,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},g=function(e){return s(void 0,void 0,void 0,function(){var t,r,i,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return t=si(),r=ui(),i=Ke(n.apiKey),a=h("undefined"!=typeof location&&location.href||""),c={event_type:p},s=[{}],[4,ci()];case 1:return[2,(c.event_properties=o.apply(void 0,[o.apply(void 0,s.concat([u.sent()])),(l={"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":a,"[Amplitude] Page Path":"undefined"!=typeof location&&h(location.pathname)||"","[Amplitude] Page Title":hn(pn),"[Amplitude] Page URL":a.split("?")[0],"[Amplitude] Min Page Y":t,"[Amplitude] Viewport Width":r},l[He]=i,l["[Amplitude] Page View ID"]=e,l)]),c)]}})})},m=function(){return void 0===d||"function"==typeof d&&d()},y="undefined"!=typeof location?location.href:null,b=function(){s(void 0,void 0,void 0,function(){var e,i,o,s,c;return u(this,function(u){switch(u.label){case 0:return e=location.href,i=di(f,e,y||"")&&m(),y=e,i?(o=void 0,r&&(o=Be(n.apiKey,ai())),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return c=(s=t).track,[4,g(o)];case 2:c.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,d,f;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),c=!0,Ke(n.apiKey),i){try{r=new nt(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&b()}})}return m()?(a.log("Tracking page view event"),s=void 0,r&&(s=Be(n.apiKey,ai())),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i;return u(this,function(s){switch(s.label){case 0:return"attribution"===d&&li(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ve(n.apiKey)),[4,g(t)]):[3,2];case 1:i=s.sent(),e.event_type=i.event_type,e.event_properties=o(o({},e.event_properties),i.event_properties),s.label=2;case 2:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),c=!1),[2]})})}};return w},ai=function(){return"undefined"!=typeof location&&location.href||""},si=function(){var e,t,n=B();if(!n)return 0;var r=null!==(t=null!==(e=n.scrollY)&&void 0!==e?e:n.pageYOffset)&&void 0!==t?t:0;return Math.floor(r)},ui=function(){var e,t=B();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},ci=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Je,[4,(new un).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},li=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],l(Object.keys(n)),!1),l(Object.keys(i)),!1);return Object.keys(C).every(function(e){return o.includes(e)})}return!1},di=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},fi=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(rr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=pi(e);a||i.track(Cr,((t={})[Br]=vi(e.id),t[Vr]=vi(e.name),t[Hr]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=pi(e);if(a||i.track(Cr,((o={})[Br]=vi(e.id),o[Vr]=vi(e.name),o[Hr]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(Rr,((s={})[Br]=vi(e.id),s[Vr]=vi(e.name),s[Hr]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=B())?a.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},vi=function(e){if("string"==typeof e)return e},pi=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},hi=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(Dr,((t={})[Mr]=a,t[jr]=n.pathname,t[Ur]=e.id,t[Fr]=e.text,t[qr]=e.href,t))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=B())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},gi=!1,mi=function(){var e=B(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function yi(e,t){var n,r;if(e){er(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",X(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Zn(u,l,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),l=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=Zn(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",X(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var bi="1.31.0-codexsemantic-review-integration.0",wi="[Amplitude] Element Clicked",Ei="[Amplitude] Element Tag",Si="[Amplitude] Element Text",ki="[Amplitude] Page URL",Ti="[Amplitude] Viewport Height",xi="[Amplitude] Viewport Width",Pi="[Amplitude] Page View ID",Ii="data-amp-mask-attributes",Ai="data-amp-internal-shadow";function _i(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function Oi(e,t){return t.map(Ci).join(" > ")}function Ci(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var Ri=":scope > ";function Di(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function Li(e){var t,n=e.getRootNode();return Di(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function Ni(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return Di(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Mi(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=l(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var c=u.children,d=0;d<c.length;d++)r.push([c[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function ji(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=Li(r);n.push({root:o,target:r});var a=r.getRootNode();if(!Di(a))break;r=a.host}var s=n.length-1,u=!1,c=n;return s>t&&(c=n.slice(s-t),u=!0),{segments:c.reverse(),truncated:u}}function Ui(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&Di(i)?"".concat(n,":nth-of-type(").concat(Fi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Fi(e,r.children),")")}function Fi(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var qi={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Bi(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function Vi(e){return Bi(e)}var Hi={name:"stableId",try:function(e,t){var n=_i(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Vi(n))}},zi=!1,Ki=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],l([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],l([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:zi,maxShadowDomDepth:1});function Wi(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:zi,maxShadowDomDepth:$i(e.maxShadowDomDepth)})}function Yi(e,t){if(!e)return Gi();var n,r=Gi();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=$i(e.maxShadowDomDepth),Wi(r)}function $i(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Gi(){return{enabled:Ki.enabled,explicitTrackingAttribute:Ki.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(Ki.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(Ki.unstableClassPatterns),!1),maxAncestorWalkDepth:Ki.maxAncestorWalkDepth,shadowDomEnabled:Ki.shadowDomEnabled,maxShadowDomDepth:Ki.maxShadowDomDepth}}var Ji=[qi,Hi];function Xi(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Wi(t),l=null!==(o=n.strategies)&&void 0!==o?o:Ji,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=c(l),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=Oi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(Qi(d,E,e,g.name,n.logger))return E}else if(Qi(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Qi(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function Zi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var eo=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),to=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new eo(ro(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new eo(a,!0)}var s=e.tagName.toLowerCase();if(o)return new eo(s+ro(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new eo(s,!0);for(var l=no(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(l);if(y.size)for(var b=no(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+Bi(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var k=c(l),T=k.next();!T.done;T=k.next()){S+="."+Bi(T.value.slice(1))}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}return new eo(S,!1)},no=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},ro=function(e){return"#"+Bi(e)};function io(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=to(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function oo(e,t){void 0===t&&(t={});var n=Wi(e),r=new Set,i=t.logger,o=function(e){return io(e,i)},a=function(e,r){var o;return null!==(o=Xi(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Wi(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=Di(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=_i(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(Vi(p))],l(u),!1).join(" > ");if(Zi(a,h,e))return h}u.unshift(Ui(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(Ri).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&Di(t)?"".concat(Ri).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=ji(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var c=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(c)),io(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Wi(e);try{for(var a=c(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var l=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(l))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var ao,so,uo=Object.freeze({enabled:!1,maxDepth:0}),co=function(){var e=uo,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=c(d([],l(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},lo=["input","select","textarea"],fo=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ye(window.location.href,n))&&!!Ye(window.location.href,t)},vo=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!s)return!1;if(a)return a(n,r);if(!fo(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var c=t.some(function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!c)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},po=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},ho=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},go=function(e,t,n){return void 0===n&&(n=uo),n.enabled?yo(e,t,n.maxDepth):mo(e,t)},mo=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:mo(null==e?void 0:e.parentElement,t):null},yo=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=c(Ni(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},bo=function(e,t,n){return void 0===n&&(n=uo),n.enabled?Eo(e,t,n.maxDepth):wo(e,t)},wo=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},Eo=function(e,t,n){var r=wo(e,t),i=e instanceof Document?e.documentElement:e;return i?(Mi(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},So=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function ko(e){if(!e)return"";try{var t=new URL(e);return t.search="",$e(t.href)}catch(t){return $e(e)}}function To(e){var t,n;return void 0===e&&(e=B()),ko(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(so||(so={}));var xo="__AMPLITUDE_VISUAL_TAGGING__";var Po=function(){var e,t,n,r,i=B();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var Io=B(),Ao=function(e){return e.get()},_o={childList:!0,attributes:!0,characterData:!0,subtree:!0},Oo=function(e){return new Rn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),Di(e)&&i.set(e,t),s.observe(e,_o))},a=function(e,t,n){var r=n-t;r<=0||Mi(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=Ao(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!Di(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var l=c(n),d=l.next();!d.done;d=l.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,_o),function(){return t.disconnect()}})},Co=function(e){return void 0===e&&(e="click"),new Rn(function(t){var n,r=function(e){t.next(e)};return null===(n=B())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=B())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},Ro=function(){var e=Ln(new Rn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return Io.addEventListener("error",t),function(){Io.removeEventListener("error",t)}}),new Rn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return Io.addEventListener("unhandledrejection",t),function(){Io.removeEventListener("unhandledrejection",t)}}));return Ln(e,new Rn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Dt.addListener("error",t),function(){Dt.removeListener(t)}}))},Do=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},Lo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},No=function(e){var t,n,r,i,o=Object.values(Lo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(r=void 0,c(u.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=Lo[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},Mo=function(e){var t,n,r,i,o=new Map;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(r=void 0,c(u.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},jo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Lo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},Uo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,a=new Set;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var l=u.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(jo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=a.value;Do(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Fo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Ii,cn,Ai]),qo=["type"],Bo=["svg","path","g"],Vo=["password","hidden"];function Ho(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=uo),null===e)return null;var l=String(e.tagName).toLowerCase(),d={tag:l},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&Di(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!Fo.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!lo.includes(i)&&!o}(e);if(!Vo.includes(String(e.getAttribute("type")))&&!Bo.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!qo.includes(E.name)||(t.has(E.name)?g[E.name]=ln:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[Ai]="true",a)),d.shadow=!0),d}function zo(e,t){return void 0===t&&(t=uo),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(Ni(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var Ko;var Wo=function(e,t){var n,r,i,a=this;this.setPageViewApiKey=function(e){a.pageViewApiKey=e},this.replaceSensitiveString=function(e){return pn(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=zo(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=po(h.getAttribute(Ii)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return Ho(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=c(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=o(o({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=o(o({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),a.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=Yi(e,t),u=a.selectorEngine.getConfig().enabled,c=a.shadowGate.get().enabled,l=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?uo:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!c&&l.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,c,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},c=n,Object.entries(u).reduce(function(e,t){var n=l(t,2),r=n[0],i=n[1];if(r.startsWith(c)){var o=r.replace(c,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[Ei]=d,r[Si]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[ki]=$e(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=hn(a.replaceSensitiveString),r[Ti]=window.innerHeight,r[xi]=window.innerWidth,r),y=Ve(a.pageViewApiKey);if(y&&(m[Pi]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return ho(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=uo),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=ji(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var c=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=go(u,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=a.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(cn,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=c(o),u=s.next();!u.done;u=s.next()){var l=u.value;l.nodeType!==Node.TEXT_NODE?l instanceof Element&&(l.hasAttribute(cn)||l.hasAttribute("contenteditable")?i+=ln:i+=a.getTextWithMaskedDescendants(l)):i+=l.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!zo(e,t).some(function(e){return e.hasAttribute(cn)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(cn))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(cn,"]"))}(e)},this.getText=function(e){if(a.hasMaskedAncestor(e))return ln;var t="";return t=e.querySelector("[".concat(cn,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[Ei]=i,t[Si]=a.getText(e),t[ki]=window.location.href.split("?")[0],t);return ho(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Ko||(Ko=oo(Yi())),Ko),this.shadowGate=(ao||(ao=co()),ao);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=c(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function Yo(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var $o,Go=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function Jo(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,s=new Map,u=new Set,c=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},l=function(e){if(function(e){var t=B(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,a=Math.max(i.left,0),s=Math.min(i.right,r);if(o<-1||o>n+1||a>=s||i.width<=0)return!1;for(var u=Go(e,t.getComputedStyle(e).position);u;){var c=t.getComputedStyle(u),l=c.overflowY&&"visible"!==c.overflowY,d=c.overflowX&&"visible"!==c.overflowX;if(l||d){var f=u.getBoundingClientRect();if(l&&(o<f.top-1||o>f.bottom+1))return!1;if(d&&(a=Math.max(a,f.left))>=(s=Math.min(s,f.right)))return!1}u=Go(u,c.position)}return!0}(e)){if(!a.get(e)&&!s.get(e)){var t=setTimeout(function(){a.set(e,!0);var t=r.getElementPath(e);n(t),s.set(e,null)},o);s.set(e,t)}}else c(e)},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(u.add(n),l(n)):(u.delete(n),c(n))}),p=f.subscribe(function(){u.forEach(l)}),h=function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function Xo(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,c=e.exposureDuration,l=e.quietMs,d=void 0===l?150:l,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},c+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}($o||($o={}));var Qo=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",bi);var w=e.dataAttributePrefix,E=void 0===w?Nt:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:Lt,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Mt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var T=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),x=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:x}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,I,A="@amplitude/plugin-autocapture-browser",_=[],O=new Wo(e,t),C=new Set,R=new Set,D=new Set,L=function(){var t,n,r=Nn(Co().map(function(t){return O.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Nn(new Rn(function(t){var n,r=function(n){var r=O.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=B())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=B())||void 0===e?void 0:e.document.removeEventListener("change",r,{capture:!0})}}));window.navigation&&(n=Nn(new Rn(function(t){var n=function(n){var r=O.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=O.shadowGate,a=Nn(Oo(o).map(function(t){return O.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new Rn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=B())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=B())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=B())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=B())||void 0===t||t.removeEventListener("resize",r)}}),u=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new Rn(function(n){var r=B();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:0}),s=t.join(","),u=function(e){e instanceof Element&&e.matches(s)&&a.observe(e),e.querySelectorAll(s).forEach(function(e){a.observe(e)})},c=function(e){if(o)try{bo(e,s,Ao(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&Ao(o).enabled?bo(e,s,Ao(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(r.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)u(e);else if(e instanceof Element)if(o&&Ao(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(e)}else u(e)})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),a.disconnect()}})}(a,e.cssSelectorAllowlist,function(e){I=e},o);return(t={})[$o.ChangeObservable]=i,t[$o.ClickObservable]=r,t[$o.MutationObservable]=a,t[$o.NavigateObservable]=n,t[$o.ScrollObservable]=s,t[$o.ExposureObservable]=u,t},N=No(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=Mo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new Uo(e,t,n,r)}(N,M,O,e);return{name:A,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,c,f,v,p,h,g,m,y,b,w,S,U,F,q,V,H,z,K,W,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie,oe,ae,se,ue,ce,le,de,fe;return u(this,function(u){return"undefined"==typeof document||(O.setPageViewApiKey(t.apiKey),Ke(t.apiKey),r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=No(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=Mo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),O.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(a=Yo(t,O))&&_.push({unsubscribe:a}),s=vo(e,e.cssSelectorAllowlist),c=vo(e,e.actionClickAllowlist),f=L(),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(So).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(wi,e.targetElementProperties)})}({allObservables:f,amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(So).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:f,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,l=s.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=go(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(So).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Ln(u,c):u,f=Ln(l,d),v=null,p=null;return Dn(f,function(e){if(v&&(clearTimeout(v),v=null),"click"===e.type)return p=e,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(wi,i("click",e.closestTrackedAncestor)))})}({allObservables:f,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:c}),h&&_.push(h),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=Po(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=Po(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:f,amplitude:n}),_.push(g),m=o({},g.getState()),y=function(){g.seed();var e=g.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,S=!1,F={},q=B(),H=function(){var e;g.reset();var t=g.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,D.clear(),C.clear(),R.clear(),null===(e=F.exposure)||void 0===e||e.reset(),null==V||V.reset()},z=function(){b=!0},K=function(e){if(b)return e?void H():void(w=!0);e&&(null==V||V.reset()),e&&r?H():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,c=e.exposureTracker,l=e.isPageEnd,d=e.lastScroll,f=e.apiKey,v=o.getState(),p=B(),h=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,g=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,m=Array.from(a).filter(function(e){return!u.has(e)}),y=((t={})[ki]=To(p),t["[Amplitude] Max Page X"]=v.maxX+h,t["[Amplitude] Max Page Y"]=v.maxY+g,t["[Amplitude] Min Page Y"]=v.minY,t[Ti]=g,t[xi]=h,t[He]=Ke(f),t["[Amplitude] Element Exposed"]=m,t),b=Ve(f);b&&(y[Pi]=b);var w=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,s.clear(),u.clear(),null==c||c.reset()};0!==m.length||v.maxX!==d.maxX||v.maxY!==d.maxY||v.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",y),d.maxX=v.maxX,d.maxY=v.maxY,d.minY=v.minY,m.forEach(function(e){u.add(e)}),a.clear(),l&&w()):l&&w()}({amplitude:n,scrollTracker:g,currentElementExposed:D,elementExposedForPage:C,elementExposedInSentEvents:R,exposureTracker:F.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},Y=function(){W&&(clearTimeout(W),W=void 0)},$=function(){Y(),W=setTimeout(function(){W=void 0,G()},0)},G=function(){if(Y(),null==U||U.removeEventListener("abort",$),U=void 0,b){b=!1,g.reset(),y();var e=w,t=S;w=!1,S=!1,e&&K(t)}},J=function(){Y(),null==U||U.removeEventListener("abort",$),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||G()},Q=function(e){Y(),null==U||U.removeEventListener("abort",$),U=void 0,e&&(e.aborted?G():(U=e,e.addEventListener("abort",$,{once:!0})))},Z=To(q),ee=function(e){var t=To(q);return t!==Z&&(b&&e&&e.deferScrollBaseline?(J(),H(),Z=t,!0):(Z=t,K(!0),(null==e?void 0:e.deferScrollBaseline)?(z(),!0):(y(),!1)))},te=function(e,t){var n=To(q),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return To(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return ko(new URL(e,r).href)}catch(e){return To(t)}}(t,q);n!==r?(Z=r,K(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,C,R,D,K)},T&&(F.exposure=Jo({allObservables:f,onExposure:ne,dataExtractor:O,exposureDuration:x}),F.exposure&&_.push(F.exposure),V=Xo({mutationObservable:f[$o.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==I||I()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),K(!1)},exposureDuration:x}),V.start(),_.push({unsubscribe:function(){null==V||V.stop()}}),re=function(){if(b)return S=!0,w=!0,void G();K(!0)},null==q||q.addEventListener("beforeunload",re),P=function(){null==q||q.removeEventListener("beforeunload",re)},_.push({unsubscribe:function(){return P()}}),(ie=f[$o.NavigateObservable])?(_.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=ko(i);if(o===Z)return;return b?(w=!1,S=!1,Z=o,K(!0),void Q(e.event.signal)):(Z=o,K(!0),z(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",G),oe.addEventListener("navigateerror",X),_.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",G),oe.removeEventListener("navigateerror",X)}}))):q&&(ae=function(){ee()},q.addEventListener("popstate",ae),se=q.history.pushState,ue=q.history.replaceState,q.history&&se&&(q.history.pushState=new Proxy(se,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),q.history&&ue&&(q.history.replaceState=new Proxy(ue,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),_.push({unsubscribe:function(){q.removeEventListener("popstate",ae),q.history&&se&&(q.history.pushState=se),q.history&&ue&&(q.history.replaceState=ue)}}))),null===(fe=null==t?void 0:t.loggerProvider)||void 0===fe||fe.log("".concat(A," has been successfully added.")),window.opener&&k.enabled&&(ce=e.cssSelectorAllowlist,le=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[xo]){n[xo]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:bi}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(de=Vn(),{dataExtractor:O,isElementSelectable:vo(e,d(d([],l(ce),!1),l(le),!1)),cssSelectorAllowlist:ce,actionClickAllowlist:le}),Kn(de),de.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Un[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=c(_),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Zo=["mutation","navigate"];function ea(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function ta(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function na(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,c=[],l={},d=null;function f(e){c=[],l={},e&&(ea(l,e),c.push(e))}var v=Dn(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return ea(l,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||l.isOutOfBounds?(d&&(t=ta(c)),f(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(ta(c))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var ra,ia;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(ra||(ra={})),function(e){e.X="x",e.Y="y"}(ia||(ia={}));function oa(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function aa(e){e.changes=[],e.startTime=void 0}function sa(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var ua=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new Rn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),aa(n),aa(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===ia.X?n:i);var t=function(e,t){var n=void 0;if(oa(e)&&(n=e.startTime),oa(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),sa(n),sa(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},ca=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new Rn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===ra.DECREASING&&e.next(ia.X),r=ra.INCREASING):o.x<n.x&&(r===ra.INCREASING&&e.next(ia.X),r=ra.DECREASING),o.y>n.y?(i===ra.DECREASING&&e.next(ia.Y),i=ra.INCREASING):o.y<n.y&&(i===ra.INCREASING&&e.next(ia.Y),i=ra.DECREASING),n=o):n=o})})}({allWindowObservables:r});return ua({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){fo(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function la(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var da=4e3,fa=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=la(e,"rageClicks",qt,f),h=la(e,"deadClicks",Ut,a),g=la(e,"errorClicks",Ft,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Nt,y=new Wo(e),b=d([],l(new Set(d(d(d([],l(p),!1),l(h),!1),l(g),!1))),!1),w=function(){var e,t,n=function(e){return Nn(Co(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=Nn(Ro().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=Nn(Oo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Nn(new Rn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=Nn(new Rn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),c=Nn(new Rn(function(e){var t=function(t){e.next(t)},n={capture:!0};return Io.document.addEventListener("mousemove",t,n),function(){Io.document.removeEventListener("mousemove",t,n)}}));return(e={})[$o.ClickObservable]=r,e[$o.PointerDownObservable]=i,e[$o.MutationObservable]=s,e[$o.NavigateObservable]=t,e[$o.BrowserErrorObservable]=a,e[$o.SelectionObservable]=u,e[$o.MouseMoveObservable]=c,e};return{name:n,type:"enrichment",setup:function(t,c){return s(void 0,void 0,void 0,function(){var s,l,d,b,E,S,k,T,x,P,I,A;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),s=w(),(l=Yo(t,y))&&r.push({unsubscribe:l}),f&&(d=vo(e,p),b=na({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=vo(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return So(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===so.LEFT_OR_TOUCH_CONTACT}),l=u?Ln(s,u):s,d=Ln(c,l),f=null;return Dn(d,function(e){return f&&Zo.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(k=vo(e,g),T=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return So(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===so.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return Ln(s,a).subscribe(function(e){var n;if("click"===e.type)return l(),c=e,void(u=setTimeout(l,2e3));"error"===e.type&&c&&(t.track("[Amplitude] Error Click",o(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),c.targetElementProperties)),l())})}({amplitude:c,allObservables:s,shouldTrackErrorClick:k}),r.push(T)),v&&(x=void 0,P=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,P=e.thrashedCursor.threshold,x&&x<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),P&&P>da&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(da,", setting to ").concat(da)),P=da)),I=ca({amplitude:c,options:e,allObservables:s,directionChanges:x,thresholdMs:P}),r.push(I)),null===(A=null==t?void 0:t.loggerProvider)||void 0===A||A.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function va(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function pa(e,t){var n,r=va(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),c=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function ha(e,t){var n,r=va(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function ga(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=c(e.getEntries()),l=u.next();!l.done;l=u.next()){var d=l.value;if(!fo(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?pa(d,a):ha(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var ma,ya,ba=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,c;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=ga({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},wa="[Amplitude] Network Request",Ea="500-599";function Sa(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function ka(e,t){var n,r,i=t.split(",");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Ta(e){var t;if(e)try{var n=null===(t=B())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function xa(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(R),!1);if(void 0===e){return}}}function Pa(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function Ia(e,t){var n;void 0===t&&(t={});var r=Ta(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(Sa(o,"*.amplitude.com")||Sa(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return Sa(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!ka(e.status,Ea))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return Sa(t,e)}))&&(!r||!e.urls||Ye(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!ka(n,e.statusCodeRange||Ea))}(t,o,e.status,e.url,e.method),i){var n=xa(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=xa(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!Pa(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!Pa(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===wa}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function Aa(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return Ia(e.event,n)}).subscribe(function(e){var t,n,o,a=e.event,c=Ta(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=l.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(wa,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(ma||(ma={}));var _a=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new Rn(function(e){var n=new rn(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return sn.subscribe(n,t),function(){sn.unsubscribe(n)}});return(e={})[ma.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=B();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,ya=Aa({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return ya.unsubscribe(),[2]})})}}},Oa="web-vitals-browser",Ca="[Amplitude] Web Vitals",Ra={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let Da=-1;const La=()=>Da,Na=e=>{addEventListener("pageshow",t=>{t.persisted&&(Da=t.timeStamp,e(t))},!0)},Ma=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},ja=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Ua=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Fa=()=>Ua()?.activationStart??0;let qa=-1;const Ba=new Set,Va=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ha=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Ba)e();isFinite(qa)||(qa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Ha,!0))}},za=(e=!1)=>{if(e&&(qa=1/0),qa<0){const e=Fa(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;qa=t??Va(),addEventListener("visibilitychange",Ha,!0),addEventListener("prerenderingchange",Ha,!0),Na(()=>{setTimeout(()=>{qa=Va()})})}return{get firstHiddenTime(){return qa},onHidden(e){Ba.add(e)}}},Ka=(e,t=-1,n,r=0,i,o,a)=>{const s=Ua(),u=s?.navigationId||0;let c="navigate";return n?c=n:La()>=0?c="back-forward-cache":s&&(document.prerendering||Fa()>0?c="prerender":document.wasDiscarded?c="restore":s.type&&(c=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:r||u,navigationInteractionId:i,navigationURL:o||s?.name,navigationStartTime:a||0}},Wa=new WeakMap;function Ya(e,t){let n=Wa.get(t);return n||(n=new WeakMap,Wa.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class $a{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Ga=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},Ja=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,Xa=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Qa=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Za{l}const es=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ts=[1800,3e3],ns=(e,t={})=>{const n=Ja(t);es(()=>{const r=Ya(t,Za),i=za();let o,a=Ka("FCP");const s=Ga(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-Fa(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=Ma(e,a,ts,t.reportAllChanges),Na(n=>{a=Ka("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,La()),o=Ma(e,a,ts,t.reportAllChanges),ja(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&Ga(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&Xa(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=Ka("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=Ma(e,a,ts,t.reportAllChanges),o(!0)})},t)})},rs=[.1,.25],is=(e,t={})=>{const n=za();ns(Qa(()=>{let r,i=Ka("CLS",0);const o=Ya(t,$a),a=(n,a,s,u,c)=>{i=Ka("CLS",0,n,a,s,u,c),o.i=0,r=Ma(e,i,rs,t.reportAllChanges)},s=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},u=e=>{s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s()},l=["layout-shift"];Ja(t)&&l.push("soft-navigation");const d=Ga(l,c);d&&(r=Ma(e,i,rs,t.reportAllChanges),n.onHidden(()=>{c(d.takeRecords()),r(!0)}),Na(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,La()),ja(r)}),setTimeout(r))}))};let os=0,as=1/0,ss=0;const us=e=>{for(const t of e)t.interactionId&&(as=Math.min(as,t.interactionId),ss=Math.max(ss,t.interactionId),os=ss?(ss-as)/7+1:0)};let cs;const ls=()=>cs?os:performance.interactionCount??0;class ds{u=0;v=[];m=new Map;p;T;_(){return ls()-this.u}M(){this.u=ls(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const fs=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=Qa(e);let o=-1;const a=()=>{r(o),i()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",a,{capture:!0}),i()},{timeout:t})}},vs=[200,500],ps=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=za();es(()=>{"interactionCount"in performance||cs||(cs=Ga(["event"],us,{durationThreshold:0}));let r,i=Ka("INP");const o=Ya(t,ds),a=(n,a,s,u,c)=>{o.M(),i=Ka("INP",-1,n,a,s,u,c),r=Ma(e,i,vs,t.reportAllChanges)},s=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},u=e=>{s(),r(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=(e,t=!1)=>{fs(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},l=["event","first-input"];Ja(t)&&l.push("soft-navigation");const d=Ga(l,c,{...t,durationThreshold:t.durationThreshold??40});r=Ma(e,i,vs,t.reportAllChanges),d&&(n.onHidden(()=>{c(d.takeRecords(),!0)}),Na(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,La())}))})};class hs{p;l;h(e){this.p?.(e)}}const gs=[2500,4e3],ms=(e,t={})=>{let n=!1;const r=Ja(t);es(()=>{let i,o=za(),a=Ka("LCP");const s=Ya(t,hs),u=(r,s,u,c,l)=>{a=Ka("LCP",-1,r,s,u,c,l),i=Ma(e,a,gs,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=za(!0))},c=e=>{s.l&&e.navigationId&&Xa(s.l,e),n||i(!0),u("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&l([t])},l=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Fa(),0),s.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!a.navigationId)continue;if("interactionId"in i&&i.interactionId!=a.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(s.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(a.value=e,a.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const f=Ga(d,l);if(f){i=Ma(e,a,gs,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;fs(()=>{if(!n){if(!r){f.disconnect();for(const e of o)removeEventListener(e,s,{capture:!0})}e===a.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,s,{capture:!0});Na(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,La()),i=Ma(e,a,gs,t.reportAllChanges),ja(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},ys=[800,1800],bs=e=>{document.prerendering?es(()=>bs(e)):"complete"!==document.readyState?addEventListener("load",()=>bs(e),!0):setTimeout(e)},ws=(e,t={})=>{const n=Ja(t);let r=Ka("TTFB"),i=Ma(e,r,ys,t.reportAllChanges);bs(()=>{const o=Ua();if(o){const a=o.responseStart;r.value=Math.max(a-Fa(),0),r.entries=[o],i(!0),Na(()=>{r=Ka("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,La()),i=Ma(e,r,ys,t.reportAllChanges),i(!0)}),n&&Ga(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=Ka("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Ma(e,r,ys,t.reportAllChanges),i(!0))})},t)}})};function Es(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Ss(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Es(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var ks=Object.values(Ra);var Ts,xs=function(){var e,t=null,n=B(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,a=new Set;return{name:Oa,type:"enrichment",setup:function(n,l){return s(void 0,void 0,void 0,function(){var s,d,f,v,p,h,g,m;return u(this,function(u){return void 0===r||(o=!0,s=new Map,d=-1,f=function(e){var t=e.navigationId,o=s.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var a=$e(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":$e(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":$e(a.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),s.set(t,o)),o},v=function(e){a.add(e);var t=s.get(e);t&&(s.delete(e),function(e){return ks.some(function(t){return t in e})}(t)&&l.track(Ca,t))},p=function(){var e,t;try{for(var n=c(Array.from(s.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;v(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},h=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=c(Array.from(s.keys())),o=i.next();!o.done;o=i.next()){var a=o.value;a<t&&v(a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},ms((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=Ss(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(Ra.LCP),m),ns(g(Ra.FCP),m),ps(g(Ra.INP),m),is(g(Ra.CLS),m),ws(g(Ra.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&p()},r.addEventListener("visibilitychange",t)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},Ps=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=B();return e&&"PerformanceSoftNavigation"in e}()?xs():function(){var e=null,t=B(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:Oa,type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=$e((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":$e((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":$e(o.split("?")[0],t.loggerProvider)},ms(function(e){a["[Amplitude] LCP"]=Ss(e)}),ns(function(e){a["[Amplitude] FCP"]=Ss(e)}),ps(function(e){a["[Amplitude] INP"]=Ss(e)}),is(function(e){a["[Amplitude] CLS"]=Ss(e)}),ws(function(e){a["[Amplitude] TTFB"]=Ss(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(Ca,a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},Is=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=tt(t.apiKey,"MKTG"),this.webExpStorageKey=tt(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=C,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Oe(this.sessionTimeout,this.lastEventTime),Yr(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]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new un).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},C),t),i=Object.entries(r).reduce(function(e,t){var r,i=l(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new M),Z(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),As=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),_s=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,l,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=B(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new un).parse()];case 1:return e=t.sent(),v=Je(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];c=y(i),f.history.pushState=c,l=y(a),f.history.replaceState=l,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return As.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===c&&i&&(f.history.pushState=i),h&&t===l&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,c=void 0,l=void 0,v={},[2]})})}}},Os="AMP_CURRENT_PAGE",Cs="AMP_PREVIOUS_PAGE",Rs="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Ts||(Ts={}));var Ds=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),Ls=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=B(),i=void 0,a=!1,c=void 0,d=!1,f=!1,v=function(e){var t;try{t=new URL(e).hostname}catch(e){null==c||c.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return Ts.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?Ts.Internal:Ts.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(Rs)]:[3,3];case 1:return e=s.sent(),t=$e("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Os])||"",r=void 0,r=t===n?(null==e?void 0:e[Cs])||"":n||(document.referrer||""),[4,i.set(Rs,(o={},o[Os]=t,o[Cs]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){var t,n,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((c=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new nt(r.sessionStorage)}catch(e){null==c||c.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=$e("undefined"!=typeof location&&location.href||""),[4,i.get(Rs)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[Os])||"",!!n&&n!==o&&m!==s?[4,i.set(Rs,(y={},y[Os]=s,y[Cs]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(s){switch(s.label){case 0:return t=$e("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(Rs)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[Cs])||"",Ds.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":Ns(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":Ns(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":Ns(e,"[Amplitude] Page Path","undefined"!=typeof location&&$e(location.pathname)||""),"[Amplitude] Page Title":Ns(e,"[Amplitude] Page Title",hn(pn)),"[Amplitude] Page URL":Ns(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(Rs,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function Ns(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Ms=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},js="userProperty",Us="eventProperty",Fs=function(e){return e===js||e===Us},qs=[js,Us],Bs=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(Fs))),!1);return t.length>0?t:d([],l(qs),!1)}(e.trackingMethod).includes(t)},Vs=function(e){return Bs(e,js)},Hs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ee(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,c,l,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,_=this;return u(this,function(O){switch(O.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new oe,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:re.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,p?(m=new Pt(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:O.sent(),O.label=2;case 2:return(w=new yt(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(br,"/").concat(yr)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=B();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,ti(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=O.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&yi(t,E),e()})})]:[3,5];case 4:O.sent(),O.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return O.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,D=this.config,S=nr(D.defaultTracking)&&D.defaultTracking&&"object"==typeof D.defaultTracking&&D.defaultTracking.attribution&&"object"==typeof D.defaultTracking.attribution?o({},D.defaultTracking.attribution):{},nr(this.config.defaultTracking)&&Vs(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Is(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Is(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:O.sent(),O.label=8;case 8:return k=De(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!T||Date.now()<T,P=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(I=this.config.deferredSessionId)||this.config.optOut||(I=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:P)&&void 0!==f?f:I)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(A=Ae(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(mi()).promise];case 9:O.sent(),O.label=10;case 10:return[4,this.add(new we({diagnosticsClient:w})).promise];case 11:return O.sent(),[4,this.add(new wr).promise];case 12:return O.sent(),[4,this.add(new _e).promise];case 13:return O.sent(),function(e){gi||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),gi=!0)}(this.config),R=this.config.defaultTracking,tr(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(hi()).promise]):[3,15];case 14:O.sent(),O.label=15;case 15:return rr(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(fi()).promise]):[3,17];case 16:O.sent(),O.label=17;case 17:return ir(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(oi(pr(this.config))).promise]):[3,20];case 18:return O.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(oi(pr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),O.label=20;case 20:return nr(this.config.defaultTracking)&&function(e){return Bs(e,Us)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(_s(S)).promise]):[3,22];case 21:O.sent(),O.label=22;case 22:return sr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Qo(dr(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:O.sent(),O.label=24;case 24:return cr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(fa(fr(this.config))).promise]):[3,26];case 25:O.sent(),O.label=26;case 26:return ar(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(_a(vr(this.config))).promise]):[3,28];case 27:O.sent(),O.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.webVitals||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Ps(ur(this.config))).promise]):[3,30];case 29:O.sent(),O.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(ba(lr(this.config))).promise]):[3,32];case 31:O.sent(),O.label=32;case 32:return function(e){return tr(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Ls()).promise]):[3,34];case 33:O.sent(),O.label=34;case 34:return("boolean"==typeof(C=this.config.customEnrichment)?C:"object"==typeof C&&null!==C&&!1!==C.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(Ms()).promise]):[3,36];case 35:O.sent(),O.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return O.sent(),A.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=o(o({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});_.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var C,R,D})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){Ae(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){Ae(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(H()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new M,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=c(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=l(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ee(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ee(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ee(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,or(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Nr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Z(this.config.identify)).promise),or(this.config.defaultTracking)&&n.push(this.track(Lr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=ri(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(mr(t)){var r=t._q;t._q=[],t=gr(new M,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(mr(r)){var o=r._q;r._q=[],r=gr(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(mr(t)){var r=t._q;t._q=[],t=gr(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Vs(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Oe(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Lr||t.event_type===Nr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",X(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(te),zs=function(){var e=new Hs;return{init:me(e.init.bind(e),"init",pe(e),ge(e,["config"])),add:me(e.add.bind(e),"add",pe(e),ge(e,["config.apiKey","timeline.plugins"])),remove:me(e.remove.bind(e),"remove",pe(e),ge(e,["config.apiKey","timeline.plugins"])),track:me(e.track.bind(e),"track",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),logEvent:me(e.logEvent.bind(e),"logEvent",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),identify:me(e.identify.bind(e),"identify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),groupIdentify:me(e.groupIdentify.bind(e),"groupIdentify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),setGroup:me(e.setGroup.bind(e),"setGroup",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),revenue:me(e.revenue.bind(e),"revenue",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),flush:me(e.flush.bind(e),"flush",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),getUserId:me(e.getUserId.bind(e),"getUserId",pe(e),ge(e,["config","config.userId"])),setUserId:me(e.setUserId.bind(e),"setUserId",pe(e),ge(e,["config","config.userId"])),getDeviceId:me(e.getDeviceId.bind(e),"getDeviceId",pe(e),ge(e,["config","config.deviceId"])),setDeviceId:me(e.setDeviceId.bind(e),"setDeviceId",pe(e),ge(e,["config","config.deviceId"])),reset:me(e.reset.bind(e),"reset",pe(e),ge(e,["config","config.userId","config.deviceId"])),getSessionId:me(e.getSessionId.bind(e),"getSessionId",pe(e),ge(e,["config"])),setSessionId:me(e.setSessionId.bind(e),"setSessionId",pe(e),ge(e,["config"])),extendSession:me(e.extendSession.bind(e),"extendSession",pe(e),ge(e,["config"])),setOptOut:me(e.setOptOut.bind(e),"setOptOut",pe(e),ge(e,["config"])),setTransport:me(e.setTransport.bind(e),"setTransport",pe(e),ge(e,["config"])),getIdentity:me(e.getIdentity.bind(e),"getIdentity",pe(e),ge(e,["config"])),setIdentity:me(e.setIdentity.bind(e),"setIdentity",pe(e),ge(e,["config","config.userId","config.deviceId"])),getOptOut:me(e.getOptOut.bind(e),"getOptOut",pe(e),ge(e,["config"])),_setDiagnosticsSampleRate:me(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",pe(e),ge(e,["config"]))}},Ks=zs(),Ws=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(e){return this.videoEl=e,this},e.prototype.withEmbeddedPlayer=function(e){return this.embeddedVideoPlayer=e,this},e.prototype.withVendor=function(e){return this.vendor=e,this},e.prototype.withExtraEventProperties=function(e){return this.extraEventProperties=e,this},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){"playing"!==t.playbackState&&"playing"===n.playbackState&&e.amplitude.track("Video Content Started",o(o({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){"playing"===t.playbackState&&"playing"!==n.playbackState&&e.amplitude.track("Video Content Stopped",o(o(o({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new Qn({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();var Ys=Ks.add,$s=Ks.extendSession,Gs=Ks.flush,Js=Ks.getDeviceId,Xs=Ks.getIdentity,Qs=Ks.getOptOut,Zs=Ks.getSessionId,eu=Ks.getUserId,tu=Ks.groupIdentify,nu=Ks.identify,ru=Ks.init,iu=Ks.logEvent,ou=Ks.remove,au=Ks.reset,su=Ks.revenue,uu=Ks.setDeviceId,cu=Ks.setGroup,lu=Ks.setIdentity,du=Ks.setOptOut,fu=Ks.setSessionId,vu=Ks.setTransport,pu=Ks.setUserId,hu=Ks.track,gu=Ks._setDiagnosticsSampleRate,mu=Object.freeze({__proto__:null,add:Ys,extendSession:$s,flush:Gs,getDeviceId:Js,getIdentity:Xs,getOptOut:Qs,getSessionId:Zs,getUserId:eu,groupIdentify:tu,identify:nu,init:ru,logEvent:iu,remove:ou,reset:au,revenue:su,setDeviceId:uu,setGroup:cu,setIdentity:lu,setOptOut:du,setSessionId:fu,setTransport:vu,setUserId:pu,track:hu,_setDiagnosticsSampleRate:gu,createInstance:zs,AmplitudeBrowser:Hs,runQueuedFunctions:hr,Revenue:ne,Identify:M,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new Ws(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o({view_session_id:H()},a)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:Kr});!function(e){if(e.scriptUrl){var t=vt(e.scriptUrl);t&&function(e){var t=B();if(t){var n=dt();n.includes(e)||(n.push(e),t[lt]=n)}}(t)}}({scriptUrl:function(){if("undefined"==typeof document)return;var e=document.currentScript;if(null==e?void 0:e.src)return e.src;return}()}),function(){var e=B();if(e){var t=function(e){var t=zs(),n=B();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},mu,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],hr(mu,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitude._iq[o],t(o)),s=a._q;a._q=[],hr(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
2
2
  //# sourceMappingURL=amplitude-min.js.map